Hello Aman Sinha, Fang-Yu Rao, Joe McDonnell, Michael Smith,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/22095

to look at the new patch set (#4).

Change subject: IMPALA-13521: Calcite planner: Handle function problem with 
char params
......................................................................

IMPALA-13521: Calcite planner: Handle function problem with char params

There is an issue in Calcite that it treats literals as a CHAR type
whereas Impala treats a literal as a STRING type. This is fixed at
coercion time.

However, at validation time, it is possible that a function is passed
an operand which originated as a literal type, but the information is
lost by the time it hits the function.  An example of this is in
exprs.test:

select from_unixtime(tmp.val, tmp.fmt) from (values
(0 as val, 'yyyy-MM-dd HH:mm:ss' as fmt),
(34304461, 'HH:mm:ss dd/yyyy/MM'),
(68439783, 'yyyy||MMM||dd||HHmmss')) as tmp

The validator sees the literal in the values clause and creates a char
type. When we validate the from_unixtime, Calcite propagates the char
type into the function. This was failing since the from_unixtime
function prototype only takes string params.

The fix for this is to do 2 passes.  Once with the char type and once
with a string type if it detects any char types. If the type was
actually a char type, it would fail later in the code after coercion
is done (which would not change the char type to a string type).

Change-Id: Icc07c6cacb81d02ba0659f2f3d8ececcc63f715e
---
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/CommonOperatorFunctions.java
1 file changed, 27 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/95/22095/4
--
To view, visit http://gerrit.cloudera.org:8080/22095
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Icc07c6cacb81d02ba0659f2f3d8ececcc63f715e
Gerrit-Change-Number: 22095
Gerrit-PatchSet: 4
Gerrit-Owner: Steve Carlin <[email protected]>
Gerrit-Reviewer: Aman Sinha <[email protected]>
Gerrit-Reviewer: Fang-Yu Rao <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>

Reply via email to