Hello Quanlong Huang, Aman Sinha, Jason Fehr, Aleksandr Efimov, Joe McDonnell,
Michael Smith, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/24217
to look at the new patch set (#6).
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.
Special care was needed for the Decimal comparison to boolean.
By default, Calcite takes care of equals comparisons. In doing so,
Calcite casts the boolean to a Decimal in the "booleanEquality"
method. When the "commonType" is found, it then creates a cast on
top of the boolean which is already cast to a decimal. Impala fails
the first cast of boolean to decimal because Impala considers them
incompatible. So booleanEquality returns false in this case, but
it will still be cast in the "commonType" 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
---
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, 404 insertions(+), 0 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/17/24217/6
--
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: newpatchset
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]>