You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/11/30 02:56:00 UTC

[jira] [Resolved] (CALCITE-2718) field names are unexpected after ProjectRemoveRule applied

     [ https://issues.apache.org/jira/browse/CALCITE-2718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde resolved CALCITE-2718.
----------------------------------
       Resolution: Not A Problem
    Fix Version/s:     (was: 1.18.0)

We don't guarantee to preserve names when planner rules are applied. If we guaranteed to preserve names, we would have to forego some important optimizations.

The safest thing is to reference fields by position rather than name. We do preserve position and type.

> field names are unexpected after ProjectRemoveRule applied
> ----------------------------------------------------------
>
>                 Key: CALCITE-2718
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2718
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: godfrey he
>            Assignee: Julian Hyde
>            Priority: Major
>
> {code:java}
> @Test public void testProjectRemove() {
>     final String sql = "select name as n from (select name from dept) t";
>     sql(sql).withRule(ProjectRemoveRule.INSTANCE).check();
>   }
> {code}
> currently, the result plan is: 
> {panel:title=plan}
> LogicalProject(NAME=[$1])
>   LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
> {panel}
> the filed name of LogicalProject should be `N` instead of `NAME`



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