Steve Carlin has posted comments on this change. ( http://gerrit.cloudera.org:8080/24268 )
Change subject: IMPALA-14910: Calcite planner: support expressions in limit clause ...................................................................... Patch Set 3: (3 comments) http://gerrit.cloudera.org:8080/#/c/24268/3/java/calcite-planner/src/main/java/org/apache/impala/calcite/rules/ImpalaSortSimplifyRule.java File java/calcite-planner/src/main/java/org/apache/impala/calcite/rules/ImpalaSortSimplifyRule.java: http://gerrit.cloudera.org:8080/#/c/24268/3/java/calcite-planner/src/main/java/org/apache/impala/calcite/rules/ImpalaSortSimplifyRule.java@50 PS3, Line 50: if (sort.fetch instanceof RexLiteral && sort.offset instanceof RexLiteral) { > Small thing: for the common shape the offset is null rather than a literal, Done http://gerrit.cloudera.org:8080/#/c/24268/3/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java File java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java: http://gerrit.cloudera.org:8080/#/c/24268/3/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java@193 PS3, Line 193: // Offset and limit expressions will always have a BIGINT type. > Could the comment say what reads this type? I followed the fetch through Bl Moved the logic into CoerceNodes. At that point, we can see if the RexLiteral is an integer type http://gerrit.cloudera.org:8080/#/c/24268/3/testdata/workloads/functional-query/queries/QueryTest/calcite.test File testdata/workloads/functional-query/queries/QueryTest/calcite.test: http://gerrit.cloudera.org:8080/#/c/24268/3/testdata/workloads/functional-query/queries/QueryTest/calcite.test@1380 PS3, Line 1380: select id from functional.alltypes order by id limit 1 + 1 > Would you mind adding a couple more cases here? The validator change covers Added some tests Note: I couldn't catch "limit id". That throws an exception in the validator which is too early for coerce nodes. The message is ugly, but the result is the same. I'll file a Jira to try to fix this at a later date, but it seems highly unlikely one would put an non-constant expression in a LIMIT clause, so I don't think it's worth jumping through hoops to get the right message. -- To view, visit http://gerrit.cloudera.org:8080/24268 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ic01a0144671485156654e7685d0d5816fa743f9d Gerrit-Change-Number: 24268 Gerrit-PatchSet: 3 Gerrit-Owner: Steve Carlin <[email protected]> Gerrit-Reviewer: Aleksandr Efimov <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Steve Carlin <[email protected]> Gerrit-Comment-Date: Tue, 25 Aug 2026 03:12:26 +0000 Gerrit-HasComments: Yes
