Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/22095 )
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 Reviewed-on: http://gerrit.cloudera.org:8080/22095 Reviewed-by: Michael Smith <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- M java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/CommonOperatorFunctions.java 1 file changed, 27 insertions(+), 1 deletion(-) Approvals: Michael Smith: Looks good to me, approved Impala Public Jenkins: Verified -- 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: merged Gerrit-Change-Id: Icc07c6cacb81d02ba0659f2f3d8ececcc63f715e Gerrit-Change-Number: 22095 Gerrit-PatchSet: 6 Gerrit-Owner: Steve Carlin <[email protected]> Gerrit-Reviewer: Aman Sinha <[email protected]> Gerrit-Reviewer: Fang-Yu Rao <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Joe McDonnell <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Steve Carlin <[email protected]>
