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

Volodymyr Vysotskyi commented on CALCITE-2470:
----------------------------------------------

[~julianhyde], thanks for pointing to these tests. I have reviewed these 
changes, all looks good, but I have a single point - the behavior of 
{{RelBuilder.project}} method does not depend on the value of {{force}} 
argument - for both cases if underlying rel node is a project, it will be 
replaced with the new project.

I have checked these changes with Drill, and there are no issues with dynamic 
tables, but exists more complex one: some tests with queries where the argument 
of one function was another one, failed if the inner function returned complex 
output (i.e map or array).
For example this query:
{code:sql}
select mycol['x'] as COMPLEX_COL from (select convert_from('{ x : [1,2], y : 
100 }', 'JSON') as mycol) as foo(mycol)
{code}
cannot be executed in Drill with these changes because of merging two projects 
with their function calls into a single one.

> RelBuilder.project should combine expressions if underlying node is a Project
> -----------------------------------------------------------------------------
>
>                 Key: CALCITE-2470
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2470
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.18.0
>
>
> The {{RelBuilder.project}} method should combine expressions if underlying 
> node is a {{Project}}.
> For example, if {{r}} is a {{RelBuilder}} and its stack initially contains
> {code:java}
> Project(Scan(T), a, b, a + b as c){code}
> and we call (in pseudo-code)
> {code:java}
> r.project(a + c as d){code}
> then the result should be
> {code:java}
> Project(Scan(T), a + (a + b) as d){code}
> Today the result is
> {code:java}
> Project(Project(Scan(T), a, a + b as c), a + c as d){code}
> In some circumstances the result will be larger (i.e. contain more 
> {{RexNode}} instances) but much more frequently the result will be smaller 
> and simpler.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to