This is an automated email from the ASF dual-hosted git repository. jakevin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 719b8ca340 [enhance](Nereids): polish code (#16368) 719b8ca340 is described below commit 719b8ca3407a951927b63b9e6c7fb1986f6a8902 Author: jakevin <jakevin...@gmail.com> AuthorDate: Mon Feb 6 12:06:55 2023 +0800 [enhance](Nereids): polish code (#16368) --- .../jobs/batch/NereidsRewriteJobExecutor.java | 2 +- .../rules/rewrite/logical/AdjustNullable.java | 4 +- .../rewrite/logical/PushFilterInsideJoin.java | 2 - .../nereids/trees/plans/logical/LogicalFilter.java | 7 +-- .../join/InnerJoinLAsscomProjectTest.java | 28 +++++------ .../exploration/join/InnerJoinLAsscomTest.java | 16 +++---- .../join/InnerJoinLeftAssociateTest.java | 4 +- .../join/InnerJoinRightAssociateTest.java | 4 +- .../rules/exploration/join/JoinCommuteTest.java | 2 +- .../rules/exploration/join/JoinExchangeTest.java | 6 +-- .../join/OuterJoinLAsscomProjectTest.java | 20 ++++---- .../exploration/join/OuterJoinLAsscomTest.java | 16 +++---- .../SemiJoinLogicalJoinTransposeProjectTest.java | 12 ++--- .../join/SemiJoinLogicalJoinTransposeTest.java | 12 ++--- .../join/SemiJoinSemiJoinTransposeProjectTest.java | 4 +- .../join/SemiJoinSemiJoinTransposeTest.java | 4 +- ...eOuterTest.java => EliminateOuterJoinTest.java} | 8 ++-- .../logical/ExtractFilterFromCrossJoinTest.java | 2 +- .../rewrite/logical/PushFilterInsideJoinTest.java | 4 +- .../logical/PushdownFilterThroughJoinTest.java | 10 ++-- .../rules/rewrite/logical/ReorderJoinTest.java | 54 +++++++++++----------- .../doris/nereids/util/LogicalPlanBuilder.java | 16 +++---- 22 files changed, 114 insertions(+), 123 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java index cc0299feb7..f38484f3be 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/batch/NereidsRewriteJobExecutor.java @@ -101,7 +101,7 @@ public class NereidsRewriteJobExecutor extends BatchRulesJob { .add(topDownBatch(RuleSet.PUSH_DOWN_FILTERS, false)) .add(visitorJob(RuleType.INFER_PREDICATES, new InferPredicates())) .add(topDownBatch(RuleSet.PUSH_DOWN_FILTERS, false)) - .add(topDownBatch(ImmutableList.of(PushFilterInsideJoin.INSTANCE))) + .add(topDownBatch(ImmutableList.of(new PushFilterInsideJoin()))) .add(topDownBatch(ImmutableList.of(new FindHashConditionForJoin()))) .add(topDownBatch(RuleSet.PUSH_DOWN_FILTERS, false)) .add(topDownBatch(ImmutableList.of(new InnerToCrossJoin()))) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/AdjustNullable.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/AdjustNullable.java index 3f9ff0d215..42ebe1e2da 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/AdjustNullable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/AdjustNullable.java @@ -76,9 +76,7 @@ public class AdjustNullable implements RewriteRuleFactory { List<Expression> otherConjuncts = updateExpressions(join.getOtherJoinConjuncts(), exprIdSlotMap); return join.withJoinConjuncts(hashConjuncts, otherConjuncts).recomputeLogicalProperties(); })), - RuleType.ADJUST_NULLABLE_ON_LIMIT.build(logicalLimit().then(limit -> { - return limit.recomputeLogicalProperties(); - })), + RuleType.ADJUST_NULLABLE_ON_LIMIT.build(logicalLimit().then(LogicalPlan::recomputeLogicalProperties)), RuleType.ADJUST_NULLABLE_ON_PROJECT.build(logicalProject().then(project -> { Map<ExprId, Slot> exprIdSlotMap = collectChildrenOutputMap(project); List<NamedExpression> newProjects = updateExpressions(project.getProjects(), exprIdSlotMap); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/PushFilterInsideJoin.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/PushFilterInsideJoin.java index d67cea0e0d..0ea7f62f86 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/PushFilterInsideJoin.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/PushFilterInsideJoin.java @@ -32,8 +32,6 @@ import java.util.List; * Push the predicate in the LogicalFilter to the join children. */ public class PushFilterInsideJoin extends OneRewriteRuleFactory { - public static final PushFilterInsideJoin INSTANCE = new PushFilterInsideJoin(); - @Override public Rule build() { return logicalFilter(logicalJoin()) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalFilter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalFilter.java index e0f312f65b..b0dd2827bf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalFilter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalFilter.java @@ -50,7 +50,7 @@ public class LogicalFilter<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_T private final boolean singleTableExpressionExtracted; public LogicalFilter(Set<Expression> conjuncts, CHILD_TYPE child) { - this(conjuncts, Optional.empty(), Optional.empty(), child); + this(conjuncts, Optional.empty(), false, Optional.empty(), child); } public LogicalFilter(Set<Expression> conjuncts, boolean singleTableExpressionExtracted, @@ -59,11 +59,6 @@ public class LogicalFilter<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_T Optional.empty(), child); } - public LogicalFilter(Set<Expression> conjuncts, Optional<GroupExpression> groupExpression, - Optional<LogicalProperties> logicalProperties, CHILD_TYPE child) { - this(conjuncts, groupExpression, false, logicalProperties, child); - } - public LogicalFilter(Set<Expression> conjuncts, Optional<GroupExpression> groupExpression, boolean singleTableExpressionExtracted, Optional<LogicalProperties> logicalProperties, CHILD_TYPE child) { diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProjectTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProjectTest.java index d68e7bcb7d..3c982a2eb4 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProjectTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomProjectTest.java @@ -67,9 +67,9 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { * t1 t2 t1 t3 */ LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) .project(ImmutableList.of(0, 1, 2)) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, Pair.of(1, 1)) + .join(scan3, JoinType.INNER_JOIN, Pair.of(1, 1)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -91,9 +91,9 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { @Test void testAlias() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) .alias(ImmutableList.of(0, 2), ImmutableList.of("t1.id", "t2.id")) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan3, JoinType.INNER_JOIN, Pair.of(0, 0)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -116,10 +116,10 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { @Test void testAliasTopMultiHashJoin() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id=t2.id + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id=t2.id .alias(ImmutableList.of(0, 2), ImmutableList.of("t1.id", "t2.id")) // t1.id=t3.id t2.id = t3.id - .hashJoinUsing(scan3, JoinType.INNER_JOIN, ImmutableList.of(Pair.of(0, 0), Pair.of(1, 0))) + .join(scan3, JoinType.INNER_JOIN, ImmutableList.of(Pair.of(0, 0), Pair.of(1, 0))) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -148,7 +148,7 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { List<Expression> bottomOtherJoinConjunct = ImmutableList.of( new GreaterThan(scan1.getOutput().get(1), scan2.getOutput().get(1))); LogicalPlan bottomJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) + .join(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) .alias(ImmutableList.of(0, 1, 2, 3), ImmutableList.of("t1.id", "t1.name", "t2.id", "t2.name")) .build(); @@ -159,7 +159,7 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { new GreaterThan(bottomJoin.getOutput().get(1), scan3.getOutput().get(1)), new GreaterThan(bottomJoin.getOutput().get(3), scan3.getOutput().get(1))); LogicalPlan topJoin = new LogicalPlanBuilder(bottomJoin) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) @@ -208,7 +208,7 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { List<Expression> bottomOtherJoinConjunct = ImmutableList.of( new GreaterThan(scan1.getOutput().get(1), scan2.getOutput().get(1))); LogicalPlan bottomJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) + .join(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) .alias(ImmutableList.of(0, 1, 2, 3), ImmutableList.of("t1.id", "t1.name", "t2.id", "t2.name")) .build(); @@ -221,7 +221,7 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { new GreaterThan(bottomJoin.getOutput().get(2), new Add(bottomJoin.getOutput().get(0), scan3.getOutput().get(0)))); LogicalPlan topJoin = new LogicalPlanBuilder(bottomJoin) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); // test for no exception @@ -269,7 +269,7 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { List<Expression> bottomOtherJoinConjunct = ImmutableList.of( new GreaterThan(scan1.getOutput().get(1), scan2.getOutput().get(1))); LogicalPlan bottomJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) + .join(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) .alias(ImmutableList.of(0, 1, 2, 3), ImmutableList.of("t1.id", "t1.name", "t2.id", "t2.name")) .build(); @@ -285,7 +285,7 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { new Cast(new StringLiteral("3"), IntegerType.INSTANCE)), Literal.of("abc")))); LogicalPlan topJoin = new LogicalPlanBuilder(bottomJoin) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) @@ -331,7 +331,7 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { List<Expression> bottomOtherJoinConjunct = ImmutableList.of( new GreaterThan(scan1.getOutput().get(1), scan2.getOutput().get(1))); LogicalPlan bottomJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) + .join(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) .alias(ImmutableList.of(0, 1, 2, 3), ImmutableList.of("t1.id", "t1.name", "t2.id", "t2.name")) .build(); @@ -343,7 +343,7 @@ class InnerJoinLAsscomProjectTest implements PatternMatchSupported { new GreaterThan(new Add(bottomJoin.getOutput().get(0), bottomJoin.getOutput().get(1)), scan3.getOutput().get(1))); LogicalPlan topJoin = new LogicalPlanBuilder(bottomJoin) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomTest.java index b2173ab78b..02b340fbd2 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLAsscomTest.java @@ -66,8 +66,8 @@ public class InnerJoinLAsscomTest implements PatternMatchSupported { */ LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, Pair.of(1, 1)) + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan3, JoinType.INNER_JOIN, Pair.of(1, 1)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -98,8 +98,8 @@ public class InnerJoinLAsscomTest implements PatternMatchSupported { new GreaterThan(scan2.getOutput().get(1), scan3.getOutput().get(1))); LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) + .join(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -130,8 +130,8 @@ public class InnerJoinLAsscomTest implements PatternMatchSupported { new GreaterThan(scan2.getOutput().get(0), new Add(scan1.getOutput().get(0), scan3.getOutput().get(0)))); LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) + .join(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); // test for no exception @@ -157,8 +157,8 @@ public class InnerJoinLAsscomTest implements PatternMatchSupported { Literal.of("abc")))); LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan2, JoinType.INNER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) + .join(scan3, JoinType.INNER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); // test for no exception diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLeftAssociateTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLeftAssociateTest.java index 1891702473..fede3fe0df 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLeftAssociateTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinLeftAssociateTest.java @@ -44,9 +44,9 @@ class InnerJoinLeftAssociateTest implements PatternMatchSupported { * +--LogicalOlapScan ( qualified=db.t3, output=[id#2, name#3], candidateIndexIds=[], selectedIndexId=-1, preAgg=ON ) */ LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing( + .join( new LogicalPlanBuilder(scan2) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan3, JoinType.INNER_JOIN, Pair.of(0, 0)) .build(), JoinType.INNER_JOIN, Pair.of(0, 0) ) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinRightAssociateTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinRightAssociateTest.java index 1208e934bc..82d284dade 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinRightAssociateTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/InnerJoinRightAssociateTest.java @@ -44,8 +44,8 @@ class InnerJoinRightAssociateTest implements PatternMatchSupported { * +--LogicalOlapScan ( qualified=db.t3, output=[id#4, name#5], candidateIndexIds=[], selectedIndexId=-1, preAgg=ON ) */ LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) - .hashJoinUsing(scan3, JoinType.INNER_JOIN, Pair.of(2, 0)) + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan3, JoinType.INNER_JOIN, Pair.of(2, 0)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinCommuteTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinCommuteTest.java index 16ea387db5..0e70e82083 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinCommuteTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinCommuteTest.java @@ -36,7 +36,7 @@ public class JoinCommuteTest implements PatternMatchSupported { LogicalOlapScan scan2 = PlanConstructor.newLogicalOlapScan(1, "t2", 0); LogicalPlan join = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), join) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinExchangeTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinExchangeTest.java index 810b8c167a..2909b960c2 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinExchangeTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinExchangeTest.java @@ -40,11 +40,11 @@ class JoinExchangeTest implements PatternMatchSupported { LogicalPlan plan = new LogicalPlanBuilder( new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) .build()) - .hashJoinUsing( + .join( new LogicalPlanBuilder(scan3) - .hashJoinUsing(scan4, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan4, JoinType.INNER_JOIN, Pair.of(0, 0)) .build(), JoinType.INNER_JOIN, ImmutableList.of(Pair.of(0, 0), Pair.of(2, 2))) .build(); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/OuterJoinLAsscomProjectTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/OuterJoinLAsscomProjectTest.java index 948a7c6ccc..6ac562b800 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/OuterJoinLAsscomProjectTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/OuterJoinLAsscomProjectTest.java @@ -45,9 +45,9 @@ class OuterJoinLAsscomProjectTest implements PatternMatchSupported { @Test void testJoinLAsscomProject() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) + .join(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) .project(ImmutableList.of(0, 1, 2)) - .hashJoinUsing(scan3, JoinType.LEFT_OUTER_JOIN, Pair.of(1, 1)) + .join(scan3, JoinType.LEFT_OUTER_JOIN, Pair.of(1, 1)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -69,9 +69,9 @@ class OuterJoinLAsscomProjectTest implements PatternMatchSupported { @Test void testAlias() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) + .join(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) .alias(ImmutableList.of(0, 2), ImmutableList.of("t1.id", "t2.id")) - .hashJoinUsing(scan3, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) + .join(scan3, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -96,10 +96,10 @@ class OuterJoinLAsscomProjectTest implements PatternMatchSupported { @Test void testAliasTopMultiHashJoin() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) // t1.id=t2.id + .join(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) // t1.id=t2.id .alias(ImmutableList.of(0, 2), ImmutableList.of("t1.id", "t2.id")) // t1.id=t3.id t2.id = t3.id - .hashJoinUsing(scan3, JoinType.LEFT_OUTER_JOIN, ImmutableList.of(Pair.of(0, 0), Pair.of(1, 0))) + .join(scan3, JoinType.LEFT_OUTER_JOIN, ImmutableList.of(Pair.of(0, 0), Pair.of(1, 0))) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -113,10 +113,10 @@ class OuterJoinLAsscomProjectTest implements PatternMatchSupported { @Test void testAliasTopMultiHashJoinLeftOuterInner() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) // t1.id=t2.id + .join(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) // t1.id=t2.id .alias(ImmutableList.of(0, 2), ImmutableList.of("t1.id", "t2.id")) // t1.id=t3.id t2.id = t3.id - .hashJoinUsing(scan3, JoinType.INNER_JOIN, ImmutableList.of(Pair.of(0, 0), Pair.of(1, 0))) + .join(scan3, JoinType.INNER_JOIN, ImmutableList.of(Pair.of(0, 0), Pair.of(1, 0))) .build(); // transform failed. @@ -141,9 +141,9 @@ class OuterJoinLAsscomProjectTest implements PatternMatchSupported { new GreaterThan(scan2.getOutput().get(1), scan3.getOutput().get(1))); LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) + .join(scan2, JoinType.LEFT_OUTER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) .alias(ImmutableList.of(0, 1, 2, 3), ImmutableList.of("t1.id", "t1.name", "t2.id", "t2.name")) - .hashJoinUsing(scan3, JoinType.LEFT_OUTER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan3, JoinType.LEFT_OUTER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/OuterJoinLAsscomTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/OuterJoinLAsscomTest.java index 7307d1a280..93143e22e1 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/OuterJoinLAsscomTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/OuterJoinLAsscomTest.java @@ -46,8 +46,8 @@ public class OuterJoinLAsscomTest implements PatternMatchSupported { @Test public void testLAsscom() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) - .hashJoinUsing(scan3, JoinType.LEFT_OUTER_JOIN, Pair.of(1, 1)) + .join(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) + .join(scan3, JoinType.LEFT_OUTER_JOIN, Pair.of(1, 1)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -75,8 +75,8 @@ public class OuterJoinLAsscomTest implements PatternMatchSupported { new GreaterThan(scan1.getOutput().get(1), scan3.getOutput().get(1))); LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) - .hashJoinUsing(scan3, JoinType.LEFT_OUTER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan2, JoinType.LEFT_OUTER_JOIN, bottomHashJoinConjunct, bottomOtherJoinConjunct) + .join(scan3, JoinType.LEFT_OUTER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -99,8 +99,8 @@ public class OuterJoinLAsscomTest implements PatternMatchSupported { @Test public void testTopHashContainsB() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, ImmutableList.of(Pair.of(0, 0))) - .hashJoinUsing(scan3, JoinType.LEFT_OUTER_JOIN, ImmutableList.of(Pair.of(0, 0), Pair.of(2, 0))) + .join(scan2, JoinType.LEFT_OUTER_JOIN, ImmutableList.of(Pair.of(0, 0))) + .join(scan3, JoinType.LEFT_OUTER_JOIN, ImmutableList.of(Pair.of(0, 0), Pair.of(2, 0))) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) @@ -121,8 +121,8 @@ public class OuterJoinLAsscomTest implements PatternMatchSupported { new GreaterThan(scan2.getOutput().get(1), scan3.getOutput().get(1))); LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, ImmutableList.of(Pair.of(0, 0))) - .hashJoinUsing(scan3, JoinType.LEFT_OUTER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) + .join(scan2, JoinType.LEFT_OUTER_JOIN, ImmutableList.of(Pair.of(0, 0))) + .join(scan3, JoinType.LEFT_OUTER_JOIN, topHashJoinConjunct, topOtherJoinConjunct) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinLogicalJoinTransposeProjectTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinLogicalJoinTransposeProjectTest.java index 1b3c22065a..be00e49dc1 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinLogicalJoinTransposeProjectTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinLogicalJoinTransposeProjectTest.java @@ -50,9 +50,9 @@ public class SemiJoinLogicalJoinTransposeProjectTest { * A B A C */ LogicalPlan topJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id .project(ImmutableList.of(0)) - .hashJoinUsing(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) // t1.id = t3.id + .join(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) // t1.id = t3.id .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) @@ -80,9 +80,9 @@ public class SemiJoinLogicalJoinTransposeProjectTest { @Test public void testSemiJoinLogicalTransposeProjectLAsscomFail() { LogicalPlan topJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id .project(ImmutableList.of(0, 2)) // t1.id, t2.id - .hashJoinUsing(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(1, 0)) // t2.id = t3.id + .join(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(1, 0)) // t2.id = t3.id .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) @@ -105,9 +105,9 @@ public class SemiJoinLogicalJoinTransposeProjectTest { * A B B C */ LogicalPlan topJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id .project(ImmutableList.of(0, 2)) // t1.id, t2.id - .hashJoinUsing(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(1, 0)) // t2.id = t3.id + .join(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(1, 0)) // t2.id = t3.id .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinLogicalJoinTransposeTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinLogicalJoinTransposeTest.java index d1e0dbc883..beb2dcbb23 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinLogicalJoinTransposeTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinLogicalJoinTransposeTest.java @@ -47,8 +47,8 @@ public class SemiJoinLogicalJoinTransposeTest { * A B A C */ LogicalPlan topJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id - .hashJoinUsing(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) // t1.id = t3.id + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) // t1.id = t3.id .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) @@ -76,8 +76,8 @@ public class SemiJoinLogicalJoinTransposeTest { @Test public void testSemiJoinLogicalTransposeLAsscomFail() { LogicalPlan topJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id - .hashJoinUsing(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(2, 0)) // t2.id = t3.id + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(2, 0)) // t2.id = t3.id .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) @@ -98,8 +98,8 @@ public class SemiJoinLogicalJoinTransposeTest { * A B B C */ LogicalPlan topJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id - .hashJoinUsing(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(2, 0)) // t2.id = t3.id + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(2, 0)) // t2.id = t3.id .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeProjectTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeProjectTest.java index 58b816e329..fb4586d34e 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeProjectTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeProjectTest.java @@ -50,9 +50,9 @@ public class SemiJoinSemiJoinTransposeProjectTest implements PatternMatchSupport * t1 t2 */ LogicalPlan topJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_ANTI_JOIN, Pair.of(0, 0)) + .join(scan2, JoinType.LEFT_ANTI_JOIN, Pair.of(0, 0)) .project(ImmutableList.of(1)) - .hashJoinUsing(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 1)) + .join(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 1)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) .applyExploration(SemiJoinSemiJoinTransposeProject.INSTANCE.build()) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeTest.java index cd1d3d2308..259819492e 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/SemiJoinSemiJoinTransposeTest.java @@ -40,8 +40,8 @@ public class SemiJoinSemiJoinTransposeTest { @Test public void testSemiJoinLogicalTransposeCommute() { LogicalPlan topJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_ANTI_JOIN, Pair.of(0, 0)) - .hashJoinUsing(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) + .join(scan2, JoinType.LEFT_ANTI_JOIN, Pair.of(0, 0)) + .join(scan3, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), topJoin) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateOuterTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateOuterJoinTest.java similarity index 90% rename from fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateOuterTest.java rename to fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateOuterJoinTest.java index ad3feb5457..317d7f8f96 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateOuterTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateOuterJoinTest.java @@ -32,14 +32,14 @@ import org.apache.doris.nereids.util.PlanConstructor; import org.junit.jupiter.api.Test; -class EliminateOuterTest implements PatternMatchSupported { +class EliminateOuterJoinTest implements PatternMatchSupported { private final LogicalOlapScan scan1 = PlanConstructor.newLogicalOlapScan(0, "t1", 0); private final LogicalOlapScan scan2 = PlanConstructor.newLogicalOlapScan(1, "t2", 0); @Test void testEliminateLeft() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) // t1.id = t2.id .filter(new GreaterThan(scan2.getOutput().get(0), Literal.of(1))) .build(); @@ -55,7 +55,7 @@ class EliminateOuterTest implements PatternMatchSupported { @Test void testEliminateRight() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.RIGHT_OUTER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan2, JoinType.RIGHT_OUTER_JOIN, Pair.of(0, 0)) // t1.id = t2.id .filter(new GreaterThan(scan1.getOutput().get(0), Literal.of(1))) .build(); @@ -71,7 +71,7 @@ class EliminateOuterTest implements PatternMatchSupported { @Test void testEliminateBoth() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.FULL_OUTER_JOIN, Pair.of(0, 0)) // t1.id = t2.id + .join(scan2, JoinType.FULL_OUTER_JOIN, Pair.of(0, 0)) // t1.id = t2.id .filter(new And( new GreaterThan(scan2.getOutput().get(0), Literal.of(1)), new GreaterThan(scan1.getOutput().get(0), Literal.of(1)))) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/ExtractFilterFromCrossJoinTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/ExtractFilterFromCrossJoinTest.java index c658b6f365..dc3aa0aa8f 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/ExtractFilterFromCrossJoinTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/ExtractFilterFromCrossJoinTest.java @@ -36,7 +36,7 @@ class ExtractFilterFromCrossJoinTest implements PatternMatchSupported { @Test void testExtract() { LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.CROSS_JOIN, Pair.of(0, 0)) + .join(scan2, JoinType.CROSS_JOIN, Pair.of(0, 0)) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushFilterInsideJoinTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushFilterInsideJoinTest.java index 9b23a7312b..5111fea12c 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushFilterInsideJoinTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushFilterInsideJoinTest.java @@ -40,12 +40,12 @@ class PushFilterInsideJoinTest implements PatternMatchSupported { Expression predicates = new GreaterThan(scan1.getOutput().get(1), scan2.getOutput().get(1)); LogicalPlan plan = new LogicalPlanBuilder(scan1) - .hashJoinEmptyOn(scan2, JoinType.CROSS_JOIN) + .joinEmptyOn(scan2, JoinType.CROSS_JOIN) .filter(predicates) .build(); PlanChecker.from(MemoTestUtils.createConnectContext(), plan) - .applyTopDown(PushFilterInsideJoin.INSTANCE) + .applyTopDown(new PushFilterInsideJoin()) .printlnTree() .matchesFromRoot( logicalJoin().when(join -> join.getOtherJoinConjuncts().get(0).equals(predicates)) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushdownFilterThroughJoinTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushdownFilterThroughJoinTest.java index 789344f070..ef357db025 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushdownFilterThroughJoinTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PushdownFilterThroughJoinTest.java @@ -77,7 +77,7 @@ public class PushdownFilterThroughJoinTest implements PatternMatchSupported { Set<Expression> whereCondition = ImmutableSet.of(whereCondition1, whereCondition2); LogicalPlan plan = new LogicalPlanBuilder(rStudent) - .hashJoinEmptyOn(rScore, joinType) + .joinEmptyOn(rScore, joinType) .filter(whereCondition) .build(); @@ -98,7 +98,7 @@ public class PushdownFilterThroughJoinTest implements PatternMatchSupported { Set<Expression> whereCondition = ImmutableSet.of(whereCondition1, whereCondition2); LogicalPlan plan = new LogicalPlanBuilder(rScore) - .hashJoinEmptyOn(rStudent, joinType) + .joinEmptyOn(rStudent, joinType) .filter(whereCondition) .build(); @@ -128,7 +128,7 @@ public class PushdownFilterThroughJoinTest implements PatternMatchSupported { Set<Expression> whereCondition = ImmutableSet.of(bothSideEqualTo, leftSide, rightSide); LogicalPlan plan = new LogicalPlanBuilder(rStudent) - .hashJoinEmptyOn(rScore, joinType) + .joinEmptyOn(rScore, joinType) .filter(whereCondition) .build(); @@ -178,7 +178,7 @@ public class PushdownFilterThroughJoinTest implements PatternMatchSupported { Set<Expression> whereCondition = ImmutableSet.of(pushSide, reserveSide); LogicalPlan plan = new LogicalPlanBuilder(rStudent) - .hashJoinEmptyOn(rScore, joinType) + .joinEmptyOn(rScore, joinType) .filter(whereCondition) .build(); @@ -201,7 +201,7 @@ public class PushdownFilterThroughJoinTest implements PatternMatchSupported { Set<Expression> whereCondition = ImmutableSet.of(pushSide, reserveSide); LogicalPlan plan = new LogicalPlanBuilder(rScore) - .hashJoinEmptyOn(rStudent, joinType) + .joinEmptyOn(rStudent, joinType) .filter(whereCondition) .build(); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/ReorderJoinTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/ReorderJoinTest.java index 57cd260cb4..23f69e9b7c 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/ReorderJoinTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/ReorderJoinTest.java @@ -44,13 +44,13 @@ class ReorderJoinTest implements PatternMatchSupported { public void testLeftOuterJoin() { ImmutableList<LogicalPlan> plans = ImmutableList.of( new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) + .join(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) .filter(new EqualTo(scan3.getOutput().get(0), scan1.getOutput().get(0))) .build(), new LogicalPlanBuilder(scan1) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) - .hashJoinUsing(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) + .join(scan2, JoinType.LEFT_OUTER_JOIN, Pair.of(0, 0)) .filter(new EqualTo(scan3.getOutput().get(0), scan1.getOutput().get(0))) .build() ); @@ -62,13 +62,13 @@ class ReorderJoinTest implements PatternMatchSupported { public void testRightOuterJoin() { ImmutableList<LogicalPlan> plans = ImmutableList.of( new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.RIGHT_OUTER_JOIN, Pair.of(0, 0)) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) + .join(scan2, JoinType.RIGHT_OUTER_JOIN, Pair.of(0, 0)) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) .filter(new EqualTo(scan3.getOutput().get(0), scan1.getOutput().get(0))) .build(), new LogicalPlanBuilder(scan1) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) - .hashJoinUsing(scan2, JoinType.RIGHT_OUTER_JOIN, Pair.of(0, 0)) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) + .join(scan2, JoinType.RIGHT_OUTER_JOIN, Pair.of(0, 0)) .filter(new EqualTo(scan3.getOutput().get(0), scan1.getOutput().get(0))) .build() ); @@ -80,13 +80,13 @@ class ReorderJoinTest implements PatternMatchSupported { public void testLeftSemiJoin() { ImmutableList<LogicalPlan> plans = ImmutableList.of( new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) + .join(scan2, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) .filter(new EqualTo(scan3.getOutput().get(0), scan1.getOutput().get(0))) .build(), new LogicalPlanBuilder(scan1) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) - .hashJoinUsing(scan2, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) + .join(scan2, JoinType.LEFT_SEMI_JOIN, Pair.of(0, 0)) .filter(new EqualTo(scan3.getOutput().get(0), scan1.getOutput().get(0))) .build() ); @@ -97,16 +97,16 @@ class ReorderJoinTest implements PatternMatchSupported { @Test public void testRightSemiJoin() { LogicalPlan plan1 = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.RIGHT_SEMI_JOIN, Pair.of(0, 0)) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) + .join(scan2, JoinType.RIGHT_SEMI_JOIN, Pair.of(0, 0)) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) .filter(new EqualTo(scan3.getOutput().get(0), scan2.getOutput().get(0))) .build(); check(ImmutableList.of(plan1)); LogicalPlan plan2 = new LogicalPlanBuilder(scan2) - .hashJoinUsing( + .join( new LogicalPlanBuilder(scan1) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) .build(), JoinType.RIGHT_SEMI_JOIN, Pair.of(0, 0) ) @@ -127,13 +127,13 @@ class ReorderJoinTest implements PatternMatchSupported { public void testFullOuterJoin() { ImmutableList<LogicalPlan> plans = ImmutableList.of( new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.FULL_OUTER_JOIN, Pair.of(0, 0)) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) + .join(scan2, JoinType.FULL_OUTER_JOIN, Pair.of(0, 0)) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) .filter(new EqualTo(scan3.getOutput().get(0), scan1.getOutput().get(0))) .build(), new LogicalPlanBuilder(scan1) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) - .hashJoinUsing(scan2, JoinType.FULL_OUTER_JOIN, Pair.of(0, 0)) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) + .join(scan2, JoinType.FULL_OUTER_JOIN, Pair.of(0, 0)) .filter(new EqualTo(scan3.getOutput().get(0), scan1.getOutput().get(0))) .build() ); @@ -145,13 +145,13 @@ class ReorderJoinTest implements PatternMatchSupported { public void testCrossJoin() { ImmutableList<LogicalPlan> plans = ImmutableList.of( new LogicalPlanBuilder(scan1) - .hashJoinEmptyOn(scan2, JoinType.CROSS_JOIN) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) + .joinEmptyOn(scan2, JoinType.CROSS_JOIN) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) .filter(new EqualTo(scan1.getOutput().get(0), scan3.getOutput().get(0))) .build(), new LogicalPlanBuilder(scan1) - .hashJoinEmptyOn(scan2, JoinType.CROSS_JOIN) - .hashJoinEmptyOn(scan3, JoinType.CROSS_JOIN) + .joinEmptyOn(scan2, JoinType.CROSS_JOIN) + .joinEmptyOn(scan3, JoinType.CROSS_JOIN) .filter(new EqualTo(scan1.getOutput().get(0), scan2.getOutput().get(0))) .build() ); @@ -194,14 +194,14 @@ class ReorderJoinTest implements PatternMatchSupported { @Test public void testInnerOrCrossJoin() { LogicalPlan leftJoin = new LogicalPlanBuilder(scan1) - .hashJoinUsing(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan2, JoinType.INNER_JOIN, Pair.of(0, 0)) .build(); LogicalPlan rightJoin = new LogicalPlanBuilder(scan3) - .hashJoinUsing(scan4, JoinType.INNER_JOIN, Pair.of(0, 0)) + .join(scan4, JoinType.INNER_JOIN, Pair.of(0, 0)) .build(); LogicalPlan plan = new LogicalPlanBuilder(leftJoin) - .hashJoinEmptyOn(rightJoin, JoinType.CROSS_JOIN) + .joinEmptyOn(rightJoin, JoinType.CROSS_JOIN) .filter(new EqualTo(scan1.getOutput().get(0), scan3.getOutput().get(0))) .build(); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/LogicalPlanBuilder.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/LogicalPlanBuilder.java index ba37c768a6..04da2c6bae 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/LogicalPlanBuilder.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/LogicalPlanBuilder.java @@ -84,34 +84,34 @@ public class LogicalPlanBuilder { return from(project); } - public LogicalPlanBuilder hashJoinUsing(LogicalPlan right, JoinType joinType, Pair<Integer, Integer> hashOnSlots) { - ImmutableList<EqualTo> hashConjunts = ImmutableList.of( + public LogicalPlanBuilder join(LogicalPlan right, JoinType joinType, Pair<Integer, Integer> hashOnSlots) { + ImmutableList<EqualTo> hashConjuncts = ImmutableList.of( new EqualTo(this.plan.getOutput().get(hashOnSlots.first), right.getOutput().get(hashOnSlots.second))); - LogicalJoin<LogicalPlan, LogicalPlan> join = new LogicalJoin<>(joinType, new ArrayList<>(hashConjunts), + LogicalJoin<LogicalPlan, LogicalPlan> join = new LogicalJoin<>(joinType, new ArrayList<>(hashConjuncts), this.plan, right); return from(join); } - public LogicalPlanBuilder hashJoinUsing(LogicalPlan right, JoinType joinType, + public LogicalPlanBuilder join(LogicalPlan right, JoinType joinType, List<Pair<Integer, Integer>> hashOnSlots) { - List<EqualTo> hashConjunts = hashOnSlots.stream() + List<EqualTo> hashConjuncts = hashOnSlots.stream() .map(pair -> new EqualTo(this.plan.getOutput().get(pair.first), right.getOutput().get(pair.second))) .collect(Collectors.toList()); - LogicalJoin<LogicalPlan, LogicalPlan> join = new LogicalJoin<>(joinType, new ArrayList<>(hashConjunts), + LogicalJoin<LogicalPlan, LogicalPlan> join = new LogicalJoin<>(joinType, new ArrayList<>(hashConjuncts), this.plan, right); return from(join); } - public LogicalPlanBuilder hashJoinUsing(LogicalPlan right, JoinType joinType, List<Expression> hashJoinConjuncts, + public LogicalPlanBuilder join(LogicalPlan right, JoinType joinType, List<Expression> hashJoinConjuncts, List<Expression> otherJoinConjucts) { LogicalJoin<LogicalPlan, LogicalPlan> join = new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjucts, JoinHint.NONE, this.plan, right); return from(join); } - public LogicalPlanBuilder hashJoinEmptyOn(LogicalPlan right, JoinType joinType) { + public LogicalPlanBuilder joinEmptyOn(LogicalPlan right, JoinType joinType) { LogicalJoin<LogicalPlan, LogicalPlan> join = new LogicalJoin<>(joinType, new ArrayList<>(), this.plan, right); return from(join); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org