Aleksandr Efimov has posted comments on this change. ( http://gerrit.cloudera.org:8080/25238 )
Change subject: IMPALA-15700: Calcite planner: check DATE units ...................................................................... Patch Set 2: (7 comments) http://gerrit.cloudera.org:8080/#/c/25238/2//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/25238/2//COMMIT_MSG@12 PS2, Line 12: > nit: Adding a Testing header would be good to conform with the usual conven Added a Testing: section in PS3. http://gerrit.cloudera.org:8080/#/c/25238/2//COMMIT_MSG@13 PS2, Line 13: Retain > Unclear what was retained vs newly added (both Java and QueryTest files are Reworded the message in PS3 to say that both the Java tests and shared QueryTest are new. http://gerrit.cloudera.org:8080/#/c/25238/2/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/25238/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java@52 PS2, Line 52: import org.apache.calcite.avatica.util.TimeUnit; > nit: this import should be above sql.type.* imports. Moved the import above sql.type imports in PS3. http://gerrit.cloudera.org:8080/#/c/25238/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java@191 PS2, Line 191: equals > Would using .equalsIgnoreCase() be safer? If a function is registered under Used equalsIgnoreCase() for DATE_ADD and DATE_SUB in PS3. http://gerrit.cloudera.org:8080/#/c/25238/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java@189 PS2, Line 189: (call.getKind() != SqlKind.PLUS : && call.getKind() != SqlKind.MINUS : && !call.getOperator().getName().equals("DATE_ADD") : && !call.getOperator().getName().equals("DATE_SUB")) > I think extracting this condition into its own helper method would be clean Extracted isDateTimeArithmeticCall() in PS3. http://gerrit.cloudera.org:8080/#/c/25238/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java@211 PS2, Line 211: switch (unit) { > I think this can drift from fe in case there are future edits. A short cros Added a reference to TimestampArithmeticExpr.analyze() in PS3. http://gerrit.cloudera.org:8080/#/c/25238/2/java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteDateIntervalTest.java File java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteDateIntervalTest.java: http://gerrit.cloudera.org:8080/#/c/25238/2/java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteDateIntervalTest.java@113 PS2, Line 113: expected > This seems like a loose assertion as this cant verify the 'HOUR' - style pr PS3 also checks the quoted unit, such as 'HOUR', in both planner error messages. -- To view, visit http://gerrit.cloudera.org:8080/25238 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I893573f2db1538490cf0f6c12b275c705366263d Gerrit-Change-Number: 25238 Gerrit-PatchSet: 2 Gerrit-Owner: Aleksandr Efimov <[email protected]> Gerrit-Reviewer: Aleksandr Efimov <[email protected]> Gerrit-Reviewer: Arnab Karmakar <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Steve Carlin <[email protected]> Gerrit-Comment-Date: Thu, 29 Oct 2026 11:34:18 +0000 Gerrit-HasComments: Yes
