Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public class EqualityInference
{
// Comparator used to determine Expression preference when determining canonicals
private static final Comparator<Expression> CANONICAL_COMPARATOR = Comparator
// Current cost heuristic:
// 1) Prefer fewer input symbols
// 2) Prefer smaller expression trees
// 3) Sort the expressions alphabetically - creates a stable consistent ordering (extremely useful for unit testing)
// TODO: be more precise in determining the cost of an expression
// Current cost heuristic:
// 1) Prefer fewer input symbols
// 2) Prefer smaller expression trees
// 3) Sort the expressions alphabetically - creates a stable consistent ordering (extremely useful for unit testing)
// TODO: be more precise in determining the cost of an expression
.comparingInt((ToIntFunction<Expression>) (expression -> SymbolsExtractor.extractAll(expression).size()))
.thenComparingLong(expression -> SubExpressionExtractor.extract(expression).count())
.thenComparing(Expression::toString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -823,15 +823,15 @@ public void testCorrelatedJoinWithNullCondition()
"SELECT regionkey, n.name FROM region LEFT JOIN LATERAL (SELECT name FROM nation) n ON NULL",
CREATED,
anyTree(
correlatedJoin(
List.of("r_row_number", "r_regionkey", "r_name", "r_comment"),
"CAST(null AS boolean)",
tableScan("region", Map.of(
"r_row_number", "row_number",
"r_regionkey", "regionkey",
"r_name", "name",
"r_comment", "comment")),
anyTree(tableScan("nation")))));
correlatedJoin(
List.of("r_row_number", "r_regionkey", "r_name", "r_comment"),
"CAST(null AS boolean)",
tableScan("region", Map.of(
"r_row_number", "row_number",
"r_regionkey", "regionkey",
"r_name", "name",
"r_comment", "comment")),
anyTree(tableScan("nation")))));
assertPlan(
"SELECT regionkey, n.name FROM region LEFT JOIN LATERAL (SELECT name FROM nation) n ON NULL",
any(
Expand Down