Steve Carlin 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");
> exprs-test is a good place for it. One catch: the allowCast change does not
Backed out of this change in exprs-test.

Gonna file a Jira for this instead to be fixed at a later date.

While I can fix this, the "easy" fix for this seems quite ugly.  The 
SqlOperatorBinding class is a base class for SqlCallBinding and RexCallBinding. 
To get the operand, I don't want to blindly assume it's an SqlCallBinding, 
which puts me in a position to either handle other bindings here which a) would 
be ugly and b) perhaps be incomplete at some point.

While an NPE is bad, this is an extreme situation that will probably never be 
encountered in the wild. I don't think too many people are gonna write the 
second parameter of a  "trunc" or "round" as a cast. And the consequences of 
doing that are a bit ugly, but the both do fail.



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

Reply via email to