Aleksandr Efimov has posted comments on this change. ( http://gerrit.cloudera.org:8080/24592 )
Change subject: IMPALA-15189: Support HBO for SortNode cardinality ...................................................................... Patch Set 6: (1 comment) http://gerrit.cloudera.org:8080/#/c/24592/6/fe/src/main/java/org/apache/impala/planner/SortNode.java File fe/src/main/java/org/apache/impala/planner/SortNode.java: http://gerrit.cloudera.org:8080/#/c/24592/6/fe/src/main/java/org/apache/impala/planner/SortNode.java@233 PS6, Line 233: return !(hasLimit() || isTypeTopN() || isPartitionedTopN()); `OFFSET` without `LIMIT` is still cardinality-changing here. For a legal TOTAL sort such as `ORDER BY bool_col OFFSET 5`, `createOrderByFragment()` clears the local offset but does not call `setTopNMergeParent()` because that call is under `hasLimit`. The local sort therefore delegates its HBO key to the scan. The merging exchange delegates to the same key and stores N-5 rows, while the scan stores N. `HistoricalStats` considers them the same run, so one value replaces the other. In a single-node plan, ignoring the offset also gives a parent the same child key with and without `OFFSET`, although the input cardinality differs. Could we include `offset_ > 0` in `isCardinalityPreserving()`, mark the local sort as a merge input for either LIMIT or OFFSET, and only track merging exchanges that have a LIMIT or a non-zero offset? Please also add distributed OFFSET-only and single-node parent regression tests. -- To view, visit http://gerrit.cloudera.org:8080/24592 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ib829887a91593bee124d56e661e714575fe3be97 Gerrit-Change-Number: 24592 Gerrit-PatchSet: 6 Gerrit-Owner: Quanlong Huang <[email protected]> Gerrit-Reviewer: Aleksandr Efimov <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]> Gerrit-Comment-Date: Mon, 31 Aug 2026 16:44:21 +0000 Gerrit-HasComments: Yes
