Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/21237 )
Change subject: IMPALA-12954: Implement Sorting capability for Calcite planner ...................................................................... Patch Set 11: (4 comments) This looks good, just a couple small nits http://gerrit.cloudera.org:8080/#/c/21237/11/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaSortRel.java File java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaSortRel.java: http://gerrit.cloudera.org:8080/#/c/21237/11/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaSortRel.java@166 PS11, Line 166: validateNoOrderBySort Nit: I think something like validateUnorderedLimit() or validateUnsortedLimit() would be more descriptive. http://gerrit.cloudera.org:8080/#/c/21237/11/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaSortRel.java@222 PS11, Line 222: boolean disableTopN Nit: Is there a place where we set this to true? http://gerrit.cloudera.org:8080/#/c/21237/11/java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaSortRel.java@229 PS11, Line 229: long topNBytesLimit = planCtx.getQueryOptions().topn_bytes_limit; : if (topNBytesLimit <= 0) { : return SortNode.createTopNSortNode(planCtx.getQueryOptions(), : planCtx.getNextNodeId(), root, sortInfo, offset, limit, false); : } : : long topNCardinality = : PlanNode.capCardinalityAtLimit(root.getCardinality(), limit); : long estimatedTopNMaterializedSize = : sortInfo.estimateTopNMaterializedSize(topNCardinality, offset); : : return estimatedTopNMaterializedSize < topNBytesLimit : ? SortNode.createTopNSortNode(planCtx.getQueryOptions(), : planCtx.getNextNodeId(), root, sortInfo, offset, limit, false) : : SortNode.createTotalSortNode(planCtx.getNextNodeId(), root, : sortInfo, offset); Nit: This logic looks very similar to the logic inside SortNode.createTopNSortNode(), which also does checks to see if it should use a total sort. Is it possible for us to just call SortNode.createTopNSortNode() and rely on the logic inside there? http://gerrit.cloudera.org:8080/#/c/21237/11/testdata/workloads/functional-query/queries/QueryTest/calcite.test File testdata/workloads/functional-query/queries/QueryTest/calcite.test: http://gerrit.cloudera.org:8080/#/c/21237/11/testdata/workloads/functional-query/queries/QueryTest/calcite.test@291 PS11, Line 291: # limit test : select id, abs(bigint_col) from functional.alltypestiny where id > 2 order by abs(bigint_col), id limit 3; Could we also add a test case for a simple limit without an order by? -- To view, visit http://gerrit.cloudera.org:8080/21237 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I747e107ed996862ef348f829deee47f0c0fc78d5 Gerrit-Change-Number: 21237 Gerrit-PatchSet: 11 Gerrit-Owner: Steve Carlin <[email protected]> Gerrit-Reviewer: Aman Sinha <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Joe McDonnell <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Steve Carlin <[email protected]> Gerrit-Comment-Date: Wed, 14 Aug 2024 00:13:53 +0000 Gerrit-HasComments: Yes
