[jira] [Commented] (CALCITE-6070) Incorrect field name after RelFieldTrimmer

2023-10-25 Thread LakeShen (Jira)


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

LakeShen commented on CALCITE-6070:
---

I think that the alias 'DID' should be keeped after the RelFieldTrimmer.

I test the similar sql in presto,the alias is keeped.So it maybe a bug.

> Incorrect field name after RelFieldTrimmer
> --
>
> Key: CALCITE-6070
> URL: https://issues.apache.org/jira/browse/CALCITE-6070
> Project: Calcite
>  Issue Type: Wish
>  Components: core
>Affects Versions: 1.35.0
>Reporter: ZheHu
>Priority: Minor
>
> Run the following SQL in SqlToRelConverterTest:
> {code}
> select ename as did from emp where ename='a' limit 10
> {code}
> Got planA without RelFieldTrimmer:
> {code}
> LogicalSort(fetch=[10])
>   LogicalProject(DID=[$1])
> LogicalFilter(condition=[=($1, 'a')])
>   LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> Got planB with RelFieldTrimmer:
> {code}
> LogicalSort(fetch=[10])
>   LogicalFilter(condition=[=($0, 'a')])
> LogicalProject(ENAME=[$1])
>   LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> However, the column alia DID for ENAME is missing in planB.
> Maybe we can do something about the trimmer when we have other 
> purposes(renaming column is the only purpose for this case).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6070) Incorrect field name after RelFieldTrimmer

2023-10-25 Thread ZheHu (Jira)


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

ZheHu commented on CALCITE-6070:


BTW, we can also reproduce this case in RelBuilderTest. The RelNode and its 
logical plan is as follows:
{code}
RelNode root =
builder.scan("DEPT")
.project(builder.field(0))
.filter(
builder.equals(builder.field("DEPTNO"),
builder.literal(20)))
.project(builder.alias(builder.field(0), "alia"))
.sortLimit(1, 1)
.build();

LogicalSort(offset=[1], fetch=[1])
  LogicalFilter(condition=[=($0, 20)])
LogicalProject(DEPTNO=[$0])
  LogicalTableScan(table=[[scott, DEPT]])
{code}

> Incorrect field name after RelFieldTrimmer
> --
>
> Key: CALCITE-6070
> URL: https://issues.apache.org/jira/browse/CALCITE-6070
> Project: Calcite
>  Issue Type: Wish
>  Components: core
>Affects Versions: 1.35.0
>Reporter: ZheHu
>Priority: Minor
>
> Run the following SQL in SqlToRelConverterTest:
> {code}
> select ename as did from emp where ename='a' limit 10
> {code}
> Got planA without RelFieldTrimmer:
> {code}
> LogicalSort(fetch=[10])
>   LogicalProject(DID=[$1])
> LogicalFilter(condition=[=($1, 'a')])
>   LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> Got planB with RelFieldTrimmer:
> {code}
> LogicalSort(fetch=[10])
>   LogicalFilter(condition=[=($0, 'a')])
> LogicalProject(ENAME=[$1])
>   LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> However, the column alia DID for ENAME is missing in planB.
> Maybe we can do something about the trimmer when we have other 
> purposes(renaming column is the only purpose for this case).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)