Hello Quanlong Huang, Daniel Becker, Joe McDonnell, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/20425
to look at the new patch set (#3).
Change subject: IMPALA-10086: Implicit cast comparing char and varchar
......................................................................
IMPALA-10086: Implicit cast comparing char and varchar
Until IMPALA-7368, Impala allowed comparing char and varchar slots as in
select * from functional.chars_tiny where cs = vc;
IMPALA-7368 added DATE type support, and as part of that changed
function call resolution to use a fit function based on the number of
arguments match the call types. Previously the comparison above would
take the first matching function, which happened to be equality between
STRING and STRING; CHAR and VARCHAR can both be implicitly cast to
STRING, so this function worked. With the new function resolution, the
best fit is equality between VARCHAR and VARCHAR, however implicit
casting to VARCHAR(*) from CHAR wasn't allowed.
The behavior before IMPALA-7368 was somewhat accidental; it depended on
the order that builtin EQ functions are added via
BinaryPredicate.initBuiltins -> Type.getSupportedTypes. Supported types
happened to be ordered with STRING preceding VARCHAR and CHAR. The fit
function makes sense and changing its behavior may have other
consequences; it also makes sense that CHAR should be castable to
VARCHAR.
This change allows implicit cast between matching types. That includes
equals, and adds casting to a compatible type when it is a char or
varchar and the target type is a wildcard version of the same.
Adds tests covering cast comparison and other implicit conversions.
Does not attempt to address differences from CHAR padding (IMPALA-1652).
Change-Id: Ib89d0a391bc8f2152ecd9151c8872a01ba19c436
---
M fe/src/main/java/org/apache/impala/analysis/Expr.java
M fe/src/test/java/org/apache/impala/analysis/AnalyzeExprsTest.java
M tests/query_test/test_cast_with_format.py
3 files changed, 71 insertions(+), 9 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/25/20425/3
--
To view, visit http://gerrit.cloudera.org:8080/20425
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib89d0a391bc8f2152ecd9151c8872a01ba19c436
Gerrit-Change-Number: 20425
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Smith <[email protected]>
Gerrit-Reviewer: Daniel Becker <[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]>