Steve Carlin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/24217 )

Change subject: IMPALA-14911: Calcite planner: Fix boolean to numeric comparison
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/24217/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeCoercionImpl.java
File 
java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeCoercionImpl.java:

http://gerrit.cloudera.org:8080/#/c/24217/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeCoercionImpl.java@123
PS2, Line 123:     if (SqlTypeUtil.isBoolean(type1) && 
SqlTypeUtil.isNumeric(type2)) {
> SqlTypeUtil.isNumeric() covers DECIMAL too, and that is the one numeric fam
Hmmm...

I just tested this and a simple "select cast(1.1 as decimal(2,1)) > true"

This query works for both original planner and Calcite planner.

Interestingly, the function that it chooses is gt(TINYINT, TINYINT).

When it picks the function, it is not looking for a direct compatible type.  It 
is looking for a type in which both DECIMAL and BOOLEAN can be cast.  And 
TINYINT is the common one!

So I'm not sure what you saw here...was this just observation, or did you have 
a test to prove this?  Did I miss something?



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I764dcbd2fd0d1323bfb964ed91d94cd3def594c0
Gerrit-Change-Number: 24217
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: Jason Fehr <[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: Sun, 23 Aug 2026 19:50:50 +0000
Gerrit-HasComments: Yes

Reply via email to