You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "suibianwanwan (Jira)" <ji...@apache.org> on 2025/02/21 09:56:00 UTC
[jira] [Commented] (CALCITE-4149) Missing top project when trim fields
[ https://issues.apache.org/jira/browse/CALCITE-4149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17929103#comment-17929103 ]
suibianwanwan commented on CALCITE-4149:
----------------------------------------
[~Aron.tao] Ensuring that all rules retain their aliases will cause some optimizations to fail. One solution is to addTopProject after all rules to restore the top-level 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.20.10#820010)