AFAIK, usually we cannot guarantee the columns names in the
optimization phase. However, I think we can still try our best to
preserve it while not introducing too much complexity.

For this case, I'd like to take it as an improvement we can do.

Zhe Hu <iluff...@163.com> 于2023年10月23日周一 18:32写道:
>
> Hi, community. I encounter a problem when I try RelFieldTrimmer.
> I run the following SQL in SqlToRelConverterTest:
>     select ename as did from emp where ename='a' limit 10
>
>
> I get planA without RelFieldTrimmer:
> LogicalSort(fetch=[10])
>   LogicalProject(DID=[$1])
>     LogicalFilter(condition=[=($1, 'a')])
>       LogicalTableScan(table=[[CATALOG, SALES, EMP]])
>
>
> I get planB with the RelFieldTrimmer:
> LogicalSort(fetch=[10])
>   LogicalFilter(condition=[=($0, 'a')])
>     LogicalProject(ENAME=[$1])
>       LogicalTableScan(table=[[CATALOG, SALES, EMP]])
>
>
> However, the column alia DID for ENAME is missing in planB. And I think the 
> project should be LogicalProject(DID=[$1]) in planB.
> Do I miss some relevant rules in Calcite or is it a issue we need to fix?
>
>
> Best,
> ZheHu



-- 

Best,
Benchao Li

Reply via email to