diff --git a/src/graph/optimizer/rule/PushFilterDownHashInnerJoinRule.cpp b/src/graph/optimizer/rule/PushFilterDownHashInnerJoinRule.cpp index 92b2513f80f..009983c7623 100644 --- a/src/graph/optimizer/rule/PushFilterDownHashInnerJoinRule.cpp +++ b/src/graph/optimizer/rule/PushFilterDownHashInnerJoinRule.cpp @@ -82,7 +82,7 @@ StatusOr PushFilterDownHashInnerJoinRule::transform( newGroupNode->dependsOn(const_cast(newJoinGroup)); } else { newInnerJoinNode->setOutputVar(oldFilterNode->outputVar()); - newInnerJoinNode->setColNames(oldFilterNode->colNames()); + newInnerJoinNode->setColNames(oldInnerJoinNode->colNames()); } TransformResult result; diff --git a/tests/tck/features/optimizer/PushFilterDownHashInnerJoinRule.feature b/tests/tck/features/optimizer/PushFilterDownHashInnerJoinRule.feature index 4e0b3c36732..7f9b53eecd4 100644 --- a/tests/tck/features/optimizer/PushFilterDownHashInnerJoinRule.feature +++ b/tests/tck/features/optimizer/PushFilterDownHashInnerJoinRule.feature @@ -256,3 +256,39 @@ Feature: Push Filter down HashInnerJoin rule | 10 | Traverse | 8 | | | 8 | Argument | 9 | | | 9 | Start | | | + + Scenario: push filter down hash join bug fix + Given an empty graph + And load "test" csv data to a new space + When profiling query: + """ + MATCH (v1:Label_6:Label_3)<-[e2:Rel_1]-(:Label_5)-[e3]->(v2) + WHERE (id(v1) in [20, 28, 31, 6, 4, 18, 15, 25, 9, 19, 21]) + MATCH p0 = (v2)<-[e4]-()-[e5]->(v3:Label_6) + WITH min(v3.Label_6.Label_6_4_Int) AS pa0, + v3.Label_6.Label_6_1_Bool AS pa2 + WHERE pa2 + RETURN pa2 + """ + Then the result should be, in any order: + | pa2 | + | true | + And the execution plan should be: + | id | name | dependencies | operator info | + | 17 | project | 19 | | + | 19 | aggregate | 24 | | + | 24 | HashInnerJoin | 21,29 | | + | 21 | project | 20 | | + | 20 | filter | 6 | | + | 6 | AppendVertices | 26 | | + | 26 | Traverse | 25 | | + | 25 | Traverse | 2 | | + | 2 | Dedup | 1 | | + | 1 | PassThrough | 3 | | + | 3 | Start | | | + | 29 | project | 28 | | + | 28 | Filter | 27 | {"condition": "$-.v3.Label_6.Label_6_1_Bool"} | + | 27 | AppendVertices | 11 | | + | 11 | Traverse | 10 | | + | 10 | Traverse | 9 | | + | 9 | Argument | | |