This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 3deee146805b66d5548842f28e9f64ae317bb6c6
Author: jakevin <jakevin...@gmail.com>
AuthorDate: Wed Jan 17 11:08:18 2024 +0800

    [fix](Nereids): find hash condition after infer predicate (#30026)
---
 .../org/apache/doris/nereids/jobs/executor/Rewriter.java |  3 ++-
 regression-test/data/nereids_p0/hint/fix_leading.out     |  4 ++--
 regression-test/data/nereids_p0/hint/test_leading.out    | 16 ++++++++--------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
index cbfe3d28ac8..b2f1569ea1d 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
@@ -226,7 +226,7 @@ public class Rewriter extends AbstractBatchJobExecutor {
                     // but top-down traverse can not cover this case in one 
iteration, so bottom-up is more
                     // efficient because it can find the new plans and apply 
transform wherever it is
                     bottomUp(RuleSet.PUSH_DOWN_FILTERS),
-                    //after push down, some new filters are generated, which 
needs to be optimized. (example: tpch q19)
+                    // after push down, some new filters are generated, which 
needs to be optimized. (example: tpch q19)
                     topDown(new ExpressionOptimization()),
                     topDown(
                             new MergeFilters(),
@@ -263,6 +263,7 @@ public class Rewriter extends AbstractBatchJobExecutor {
                     // after eliminate outer join, we can move some filters to 
join.otherJoinConjuncts,
                     // this can help to translate plan to backend
                     topDown(new PushFilterInsideJoin()),
+                    topDown(new FindHashConditionForJoin()),
                     topDown(new ExpressionNormalization())
             ),
 
diff --git a/regression-test/data/nereids_p0/hint/fix_leading.out 
b/regression-test/data/nereids_p0/hint/fix_leading.out
index 898fe5882b9..1410c8e0e6e 100644
--- a/regression-test/data/nereids_p0/hint/fix_leading.out
+++ b/regression-test/data/nereids_p0/hint/fix_leading.out
@@ -9,9 +9,9 @@ PhysicalResultSink
 ----------PhysicalDistribute[DistributionSpecHash]
 ------------PhysicalOlapScan[t2]
 --------PhysicalDistribute[DistributionSpecHash]
-----------NestedLoopJoin[CROSS_JOIN](t3.c3 = t4.c4)
+----------hashJoin[INNER_JOIN] hashCondition=((t3.c3 = t4.c4)) 
otherCondition=()
 ------------PhysicalOlapScan[t3]
-------------PhysicalDistribute[DistributionSpecReplicated]
+------------PhysicalDistribute[DistributionSpecHash]
 --------------PhysicalOlapScan[t4]
 
 Hint log:
diff --git a/regression-test/data/nereids_p0/hint/test_leading.out 
b/regression-test/data/nereids_p0/hint/test_leading.out
index fe3831a9fc4..29811a95161 100644
--- a/regression-test/data/nereids_p0/hint/test_leading.out
+++ b/regression-test/data/nereids_p0/hint/test_leading.out
@@ -2609,7 +2609,7 @@ PhysicalResultSink
 ------------PhysicalProject
 --------------PhysicalOlapScan[t2]
 ------------PhysicalDistribute[DistributionSpecReplicated]
---------------NestedLoopJoin[CROSS_JOIN](t1.c1 = t3.c3)
+--------------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t3.c3)) 
otherCondition=()
 ----------------PhysicalProject
 ------------------PhysicalOlapScan[t1]
 ----------------PhysicalDistribute[DistributionSpecReplicated]
@@ -2631,7 +2631,7 @@ PhysicalResultSink
 ------------PhysicalProject
 --------------PhysicalOlapScan[t2]
 ------------PhysicalDistribute[DistributionSpecReplicated]
---------------NestedLoopJoin[CROSS_JOIN](t1.c1 = t3.c3)
+--------------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t3.c3)) 
otherCondition=()
 ----------------PhysicalProject
 ------------------PhysicalOlapScan[t3]
 ----------------PhysicalDistribute[DistributionSpecReplicated]
@@ -2745,7 +2745,7 @@ PhysicalResultSink
 ------------PhysicalProject
 --------------PhysicalOlapScan[t2]
 ------------PhysicalDistribute[DistributionSpecReplicated]
---------------NestedLoopJoin[CROSS_JOIN](t1.c1 = t3.c3)
+--------------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t3.c3)) 
otherCondition=()
 ----------------PhysicalProject
 ------------------PhysicalOlapScan[t1]
 ----------------PhysicalDistribute[DistributionSpecReplicated]
@@ -2767,7 +2767,7 @@ PhysicalResultSink
 ------------PhysicalProject
 --------------PhysicalOlapScan[t2]
 ------------PhysicalDistribute[DistributionSpecReplicated]
---------------NestedLoopJoin[CROSS_JOIN](t1.c1 = t3.c3)
+--------------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t3.c3)) 
otherCondition=()
 ----------------PhysicalProject
 ------------------PhysicalOlapScan[t3]
 ----------------PhysicalDistribute[DistributionSpecReplicated]
@@ -2881,10 +2881,10 @@ PhysicalResultSink
 ------------PhysicalProject
 --------------PhysicalOlapScan[t2]
 ------------PhysicalDistribute[DistributionSpecHash]
---------------NestedLoopJoin[CROSS_JOIN](t1.c1 = t3.c3)
+--------------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t3.c3)) 
otherCondition=()
 ----------------PhysicalProject
 ------------------PhysicalOlapScan[t1]
-----------------PhysicalDistribute[DistributionSpecReplicated]
+----------------PhysicalDistribute[DistributionSpecHash]
 ------------------PhysicalProject
 --------------------PhysicalOlapScan[t3]
 
@@ -2903,10 +2903,10 @@ PhysicalResultSink
 ------------PhysicalProject
 --------------PhysicalOlapScan[t2]
 ------------PhysicalDistribute[DistributionSpecHash]
---------------NestedLoopJoin[CROSS_JOIN](t1.c1 = t3.c3)
+--------------hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t3.c3)) 
otherCondition=()
 ----------------PhysicalProject
 ------------------PhysicalOlapScan[t3]
-----------------PhysicalDistribute[DistributionSpecReplicated]
+----------------PhysicalDistribute[DistributionSpecHash]
 ------------------PhysicalProject
 --------------------PhysicalOlapScan[t1]
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to