[ https://issues.apache.org/jira/browse/CALCITE-4149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17169483#comment-17169483 ]
Jiatao Tao edited comment on CALCITE-4149 at 8/2/20, 8:45 AM: -------------------------------------------------------------- org.apache.calcite.rel.rules.ProjectRemoveRule#isTrivial returns true but it shouldn't. org.apache.calcite.rex.RexUtil#isIdentity doesn't consider alias, is this expected ? was (Author: aron.tao): org.apache.calcite.rel.rules.ProjectRemoveRule#isTrivial returns true but it shouldn't. > 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)