You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Joe McDonnell (Code Review)" <ge...@cloudera.org> on 2024/08/14 00:13:53 UTC
[Impala-ASF-CR] IMPALA-12954: Implement Sorting capability for Calcite planner
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 <sc...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Wed, 14 Aug 2024 00:13:53 +0000
Gerrit-HasComments: Yes