Aleksandr Efimov has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/24260 )

Change subject: IMPALA-14946: Catch "trunc" error within Calcite planner
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/24260/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java
File 
java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java:

http://gerrit.cloudera.org:8080/#/c/24260/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java@63
PS2, Line 63:         throw new RuntimeException("Invalid Truncate Unit for 
scale");
> Backed out of this change in exprs-test.
Makes sense to leave the cast forms for a Jira.

One thing about allowCast, which was my suggestion and does not do what I 
thought: with true, "select trunc(2.1, '1')" comes back as 
java.lang.AssertionError: cannot cast '1' as class java.lang.Integer - coercion 
inserts a real SqlKind.CAST there, isOperandLiteral unwraps it, and 
getOperandLiteralValue trips on the string. With false the same query gets 
"trunc() must be called with a constant second argument." Explicit casts behave 
the same either way, since EXPLICIT_CAST is SqlKind.OTHER and SqlUtil.isLiteral 
only unwraps SqlKind.CAST. Master hits the AssertionError too, so nothing here 
is new in PS6 - but if the cast forms are going to a Jira, would putting it 
back to false fit better for now?



--
To view, visit http://gerrit.cloudera.org:8080/24260
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I766c138fae027ba0d919daa5cce38dc93d7144d1
Gerrit-Change-Number: 24260
Gerrit-PatchSet: 2
Gerrit-Owner: Steve Carlin <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Aman Sinha <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Steve Carlin <[email protected]>
Gerrit-Comment-Date: Tue, 25 Aug 2026 19:32:18 +0000
Gerrit-HasComments: Yes

Reply via email to