Jian Zhang has posted comments on this change. ( http://gerrit.cloudera.org:8080/18862 )
Change subject: IMPALA-11485: Pushdown LIMIT through UNION and LEFT/RIGHT OUTER JOIN ...................................................................... Patch Set 5: (1 comment) http://gerrit.cloudera.org:8080/#/c/18862/5/fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java File fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java: http://gerrit.cloudera.org:8080/#/c/18862/5/fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java@412 PS5, Line 412: if (root.getChildCount() > 0) { : findNodeCanLimitPushdown(root.getChild(0), pushdownNodes); : } : if (root.getChildCount() > 1) { : findNodeCanLimitPushdown(root.getChild(1), pushdownNodes); : } 1. for the union node, it's better to go through all its children 2. for the join node, it's incorrect to go through the inner side. for example, `s right join t`, it's incorrect to find the node that can push down the limit in `s`. You can add the test to verify the result: select * from ( select * from s1 union all select * from s2 ) tmp1 right join ( select * from t1 union all select * from t2 ) tmp2 on tmp1.id=tmp2.id limit 1; -- To view, visit http://gerrit.cloudera.org:8080/18862 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ia5d040c0a98e60639d7ce4b25ecf07a859c8a32c Gerrit-Change-Number: 18862 Gerrit-PatchSet: 5 Gerrit-Owner: Baike Xia <[email protected]> Gerrit-Reviewer: Aman Sinha <[email protected]> Gerrit-Reviewer: Baike Xia <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Jian Zhang <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]> Gerrit-Comment-Date: Sun, 09 Oct 2022 11:31:53 +0000 Gerrit-HasComments: Yes
