Alex Behm has posted comments on this change.

Change subject: IMPALA-3155: Disable implicit casting of CHAR to STRING in CASE 
statements
......................................................................


Patch Set 1:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/2762/1/fe/src/main/java/com/cloudera/impala/analysis/CaseExpr.java
File fe/src/main/java/com/cloudera/impala/analysis/CaseExpr.java:

Line 247:       if 
(children_.get(0).getType().isScalarType(PrimitiveType.CHAR)) {
Not sure why this works, but you need to analyze() an expr before you can check 
its type. Looks like that expr is analyzed below in line 251. I suggest 
reworking the flow a little to make it obvious why this works.

Also add a comment for the cast (here and below) that states we are casting 
CHAR to STRING because we do not have the BE function for operating on CHAR 
directly.


http://gerrit.cloudera.org:8080/#/c/2762/1/testdata/workloads/functional-query/queries/QueryTest/exprs.test
File testdata/workloads/functional-query/queries/QueryTest/exprs.test:

Line 2420: select case when 5 < 3 then cast('L'  as char(1))  else cast('M'  as 
char(1)) end
A more appropriate place for such a test is AnalyzeExprs.TestCaseExpr() because 
the does not need test data, and the interesting assertion is just the return 
type of the case expression which is the output of analysis.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4aebac6849898693570bc3164fff40786c215358
Gerrit-PatchSet: 1
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Taras Bobrovytsky <[email protected]>
Gerrit-Reviewer: Alex Behm <[email protected]>
Gerrit-HasComments: Yes

Reply via email to