Arnab Karmakar 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)

Thanks for working on this! Looks good overall just dropped a few minor 
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 convention.


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 
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.


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 a 
different casing, validation could get skipped.


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 cleaner 
and less fragile. Something like:
if (operandCount == 2 && isDateTimeArithmeticCall(call))


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 
cross-reference comment to the class TimestampArithmeticExpr would be good.


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 prefix.



--
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: 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 10:44:53 +0000
Gerrit-HasComments: Yes

Reply via email to