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

Arina Ielchiieva commented on CALCITE-1584:
-------------------------------------------

The reason I wanted to fix this rule is that in Drill we see the following 
problem. For the query
{noformat}
select version as v from t
{noformat}
when during PHYSICAL phase ProjectRemoveRule is applied, it removes Project 
stage and thus we lose column alias.
{noformat}
-------------------------------------------
| version<VARCHAR(OPTIONAL)>              |
-------------------------------------------
| 1.10.0                                  |
-------------------------------------------
{noformat}
Query plan without ProjectRemoveRule
{noformat}
00-00    Screen
00-01      Project(v=[$0])
00-02        Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath 
[path=file:/tmp/t]], selectionRoot=/tmp/t, numFiles=1, usedMetadataFile=false, 
columns=[`version`]]])
{noformat}
Query plan without ProjectRemoveRule
{noformat}
00-00    Screen
00-01      Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath 
[path=file:/tmp/t]], selectionRoot=/tmp/t, numFiles=1, usedMetadataFile=false, 
columns=[`version`]]])
{noformat}

So I thought if I would add comparison to ProjectRemoveRule.isTrivial method by 
field names as well, ProjectRemoveRule won't remove Project stage and thus 
problem will be fixed.
Regarding r.getClass() I am not quite sure where I have to add it and how it 
would help. So its not just a confusion, it's really I can't get what is 
required to do for the fix if not changing isTrivial method. I am not a Calcite 
expert, so sorry if some of my questions or assumptions are not correct. If you 
could help to clarify what I can do for the fix, I'll really appreciate it. 

> ProjectRemoveRule loses field names
> -----------------------------------
>
>                 Key: CALCITE-1584
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1584
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jess Balint
>            Assignee: Julian Hyde
>            Priority: Minor
>
> the rule doesn't properly identify a child {{Project}} node



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to