Skip to content

Commit

Permalink
[fix](Nereids): find hash condition after infer predicate (apache#30026)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener authored Jan 17, 2024
1 parent b8a3374 commit e556cff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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())
),

Expand Down
4 changes: 2 additions & 2 deletions regression-test/data/nereids_p0/hint/fix_leading.out
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions regression-test/data/nereids_p0/hint/test_leading.out
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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]

Expand All @@ -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]

Expand Down

0 comments on commit e556cff

Please sign in to comment.