Aleksandr Efimov has posted comments on this change. ( http://gerrit.cloudera.org:8080/24718 )
Change subject: IMPALA-15278: Fix incorrect cardinality with OFFSET ...................................................................... Patch Set 1: (1 comment) http://gerrit.cloudera.org:8080/#/c/24718/1/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/24718/1/fe/src/main/java/org/apache/impala/planner/SortNode.java@307 PS1, Line 307: Preconditions.checkState(offset_ == 0, "Tie handling with offset not supported"); > There is a precondition for this: https://github.com/apache/impala/blob/5dc This matches the precondition Quanlong linked, from the other direction: I went looking for a query that reaches the new one. The paths line up to say no: ties are only set by the analytic limit pushdown, and AnalyticPlanner builds those sorts with a hardcoded offset of 0 (lines 485 and 496); a user OFFSET goes through SingleNodePlanner.createSortNode, which passes includeTies=false (line 361); DistributedPlanner line 1396 also passes 0 for the sort above the exchange; and line 1379 already holds the same checkState with the same message. Tried it on a cluster as well - "select id, rk from (select id, rank() over (order by id) rk from functional.alltypes) v where rk <= 5 order by id limit 10 offset 3" puts them on separate nodes: "06:TOP-N limit with ties: 5" under "04:TOP-N [LIMIT=10 OFFSET=3]". So the assert looks right, and I could not get SQL to reach it. -- To view, visit http://gerrit.cloudera.org:8080/24718 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3b628beabc5c7ec6c4fdda9dff6aaf7a4acae538 Gerrit-Change-Number: 24718 Gerrit-PatchSet: 1 Gerrit-Owner: Quanlong Huang <[email protected]> Gerrit-Reviewer: Aleksandr Efimov <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]> Gerrit-Comment-Date: Tue, 25 Aug 2026 17:23:56 +0000 Gerrit-HasComments: Yes
