Aleksandr Efimov 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 6: (3 comments) http://gerrit.cloudera.org:8080/#/c/24217/6/java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaRexBuilder.java File java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaRexBuilder.java: http://gerrit.cloudera.org:8080/#/c/24217/6/java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaRexBuilder.java@85 PS6, Line 85: public RexNode makeCast( > Changed it to match the Calcite logic and added the @Override Matches Calcite now - the exact numeric guard is what RexBuilder has in both spots, so casts to DOUBLE/FLOAT stay on the makeCast path. Thanks. http://gerrit.cloudera.org:8080/#/c/24217/6/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/6/java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeCoercionImpl.java@119 PS6, Line 119: protected boolean booleanEquality(SqlCallBinding binding, > Easy enough to just change it now. Added the 2=true test Ran PS7 in a test cluster: 2 = true, -1 = true and "where 2 = bool_col" now match the original planner; on the unpatched tree they came back true, true and 4. The new case sits in binary_exprs_with_boolean.test, which runs on the original planner today, so nothing exercises the Calcite side of it until the no-fallback run exists. calcite.test already carries one case from this patch - would it be worth putting "select 2 = true" next to it? http://gerrit.cloudera.org:8080/#/c/24217/6/java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeCoercionImpl.java@137 PS6, Line 137: public RelDataType commonTypeForBinaryComparison( > Added to @Override Thanks, the annotation was the part I cared about; the null case was theoretical. -- 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: 6 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: Tue, 25 Aug 2026 18:16:23 +0000 Gerrit-HasComments: Yes
