[ 
https://issues.apache.org/jira/browse/IMPALA-14422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18059729#comment-18059729
 ] 

ASF subversion and git services commented on IMPALA-14422:
----------------------------------------------------------

Commit c088e7204ab95bc7d60cfb135f230008be5e4d30 in impala's branch 
refs/heads/master from Steve Carlin
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=c088e7204 ]

IMPALA-14422: Calcite planner: Crash on Union above Values RelNode

In version 1.37, for the query:

select 1 union all select count(*) ...

Calcite was creating the following RelNode structure:

LogicalUnion
  LogicalValues (1)
  LogicalAggregate
    ...

Calcite changed the behavior in 1.40 to ensure that all datatypes are matching.
Now it produces:

LogicalUnion
  LogicalProject(CAST 1 as SMALLINT)
   LogicalValues
  LogicalProject(CAST 5000 as SMALLINT)
    LogicalAggregate

The introduction of the Project between Values exposed a bug in the
ImpalaValuesRel class. The Values node was not looking at its parent
type in the situation where the parent was a Project and the tuple size
was 1.

The code in this commit also handles projects which ignore the values
underneath. When the "trivial" query is found, it creates the Plan Node
at the Project level rather than the Values level.

One other small change is thrown into this commit. The memory allocation
in the tuple descriptor was including a byte for nulls even when the
column was non-null. This has been fixed.

The testing for this is already included in calcite.test. This will fail
on a simple "select length('hello')" query, but only after upgrading to
at least Calcite 1.40.  So this commit is necessary before upgrading,
but no additional test is needed.

Change-Id: I1edf2f0bdb9271b5b8c9716ca7d8c8f858cc108c
Reviewed-on: http://gerrit.cloudera.org:8080/23731
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Calcite planner: Crash on Union with underlying Project and Values nodes
> ------------------------------------------------------------------------
>
>                 Key: IMPALA-14422
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14422
>             Project: IMPALA
>          Issue Type: Sub-task
>            Reporter: Steve Carlin
>            Priority: Major
>
> In version 1.37, for the query 
> select 1 union all select 5000
> Calcite was creating the following RelNode structure:
> LogicalUnion
>   LogicalValues (1), (5000)
> Calcite changed the behavior in 1.40 to ensure that all datatypes are 
> matching.  Now it produces:
> LogicalUnion
>   LogicalProject(CAST 1 as SMALLINT)
>    LogicalValues 
>   LogicalProject(CAST 5000 as SMALLINT)
>    LogicalValues
> The introduction of the Project between Values exposed a bug in the 
> ImpalaValuesRel class.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to