[
https://issues.apache.org/jira/browse/CALCITE-4149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17172575#comment-17172575
]
Julian Hyde commented on CALCITE-4149:
--------------------------------------
If rules guaranteed to preserve aliases there are several important
optimizations they could not achieve. Therefore rules do not preserve aliases.
My advice is - accept this fact, and find another place to get the aliases.
> Missing top project when trim fields
> ------------------------------------
>
> Key: CALCITE-4149
> URL: https://issues.apache.org/jira/browse/CALCITE-4149
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Jiatao Tao
> Assignee: Jiatao Tao
> Priority: Major
>
> Case like that:
>
> {code:java}
> @Test void dev() throws SQLException {
> sql("model", "select t1.name as t1_name, t2.name from EMPS t1 join EMPS t2
> on t1.name = t2.name").ok();
> }
> {code}
>
> The plan after RelFieldTrimmer:
> {code:java}
> LogicalJoin(condition=[=($0, $1)], joinType=[inner])
> LogicalProject(NAME=[$1])
> LogicalTableScan(table=[[SALES, EMPS]])
> LogicalProject(NAME=[$1])
> LogicalTableScan(table=[[SALES, EMPS]])
> {code}
>
> The top project is missing, but the query has an alias, the info is lost.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)