Skip to content

Commit

Permalink
[BugFix] fix PushdownSubfieldRule for the join pushdown (backport #52846
Browse files Browse the repository at this point in the history
) (#52864)

Co-authored-by: Murphy <[email protected]>
  • Loading branch information
mergify[bot] and murphyatwork authored Nov 13, 2024
1 parent b3a7eb0 commit 4ef81b6
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,9 @@ public OptExpression visitLogicalJoin(OptExpression optExpression, Context conte
}
}

if (!leftContext.pushDownExprRefs.isEmpty()) {
visitChild(optExpression, 0, leftContext);
}
if (!rightContext.pushDownExprRefs.isEmpty()) {
visitChild(optExpression, 1, rightContext);
}
// recursively visit children no matter this node can push down something
visitChild(optExpression, 0, leftContext);
visitChild(optExpression, 1, rightContext);

Optional<Operator> project = generatePushDownProject(optExpression, childSubfieldOutputs, localContext);
if (predicate.isPresent() || onPredicate.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -981,4 +981,19 @@ public void testJoinInitError() throws Exception {
getCostPlanFragment(getDumpInfoFromFile("query_dump/join_init_error"));
Assert.assertTrue(replayPair.second, replayPair.second.contains("HASH JOIN"));
}

@Test
public void testPushdownSubfield() throws Exception {
Pair<QueryDumpInfo, String> replayPair = getPlanFragment(getDumpInfoFromFile("query_dump" +
"/pushdown_subfield"), connectContext.getSessionVariable(), TExplainLevel.NORMAL);
Assert.assertTrue(replayPair.second, replayPair.second.contains(" 10:Project\n" +
" | <slot 103> : 103: id\n" +
" | <slot 104> : 104: mock_098\n" +
" | <slot 164> : 164: mock_107\n" +
" | <slot 512> : get_json_string(107: mock_031, '$.\"email_Domain1__c\"')\n" +
" | <slot 513> : get_json_string(107: mock_031, '$.\"fY21_Territory_Score__c\"')\n" +
" | \n" +
" 9:OlapScanNode\n" +
" TABLE: tbl_mock_103"));
}
}
Loading

0 comments on commit 4ef81b6

Please sign in to comment.