Steve Carlin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/24217 )
Change subject: IMPALA-14911: Calcite planner: Fix boolean to numeric comparison ...................................................................... IMPALA-14911: Calcite planner: Fix boolean to numeric comparison This commit fixes the following failure in the Calcite planner: select count(*) from functional.alltypestiny where smallint_col > sleep(100); The coercion method for binary comparison is overridden to return the common type as the numeric so that the internals of Calcite create the cast around the boolean operand. Calcite only applied the cast to "equals" binary comparisons. For Decimal, the common type is FLOAT. The booleanEquality method was also overridden because Calcite does coercion in there as well. it will always return false so that all binary comparison coercions are done in the overridden commonTypeForBinaryComparison method. The RexBuilder makeCast method had to be overridden because the default Calcite handles boolean casting with a case statement whereas Impala can handle casts the boolean directly to a numeric type. Change-Id: I764dcbd2fd0d1323bfb964ed91d94cd3def594c0 Testing: added e2e test Reviewed-on: http://gerrit.cloudera.org:8080/24217 Tested-by: Impala Public Jenkins <[email protected]> Reviewed-by: Steve Carlin <[email protected]> --- M java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaRexBuilder.java M java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeCoercionImpl.java A testdata/workloads/functional-query/queries/QueryTest/binary_exprs_with_boolean.test M testdata/workloads/functional-query/queries/QueryTest/calcite.test M tests/query_test/test_exprs.py 5 files changed, 408 insertions(+), 0 deletions(-) Approvals: Impala Public Jenkins: Verified Steve Carlin: Looks good to me, approved -- 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: merged Gerrit-Change-Id: I764dcbd2fd0d1323bfb964ed91d94cd3def594c0 Gerrit-Change-Number: 24217 Gerrit-PatchSet: 10 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]>
