[
https://issues.apache.org/jira/browse/CALCITE-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
weihua zhang updated CALCITE-7104:
----------------------------------
Description:
{code:sql}
select d1 from (select deptno as d1, deptno as d2 from dept ) as tmp order by
d1, d2;
{code}
{noformat}
LogicalProject(D1=[$0]), id = 2284
LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC]), id = 2283
LogicalProject(D1=[$0], D2=[$0]), id = 2282
LogicalTableScan(table=[[default, dept]]), id = 2278
{noformat}
LogicalSort can change to:
{noformat}
LogicalProject(D1=[$0]), id = 2284
LogicalSort(sort0=[$0], dir0=[ASC]), id = 2283
LogicalProject(D1=[$0], D2=[$0]), id = 2282
LogicalTableScan(table=[[default, dept]]), id = 2278
{noformat}
was:
{code:sql}
select d1, d2 from (select deptno as d1, deptno as d2 from dept ) as tmp order
by d1, d2;
{code}
{noformat}
LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC]), id = 2245
LogicalProject(D1=[$0], D2=[$0]), id = 2244
LogicalTableScan(table=[[default, dept]]), id = 2240
{noformat}
LogicalSort can change to:
{noformat}
LogicalSort(sort0=[$0], dir0=[ASC]), id = 2245
LogicalProject(D1=[$0], D2=[$0]), id = 2244
LogicalTableScan(table=[[default, dept]]), id = 2240
{noformat}
> remove duplicate same sort keys
> -------------------------------
>
> Key: CALCITE-7104
> URL: https://issues.apache.org/jira/browse/CALCITE-7104
> Project: Calcite
> Issue Type: Improvement
> Reporter: weihua zhang
> Priority: Major
>
> {code:sql}
> select d1 from (select deptno as d1, deptno as d2 from dept ) as tmp order
> by d1, d2;
> {code}
> {noformat}
> LogicalProject(D1=[$0]), id = 2284
> LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC]), id = 2283
> LogicalProject(D1=[$0], D2=[$0]), id = 2282
> LogicalTableScan(table=[[default, dept]]), id = 2278
> {noformat}
> LogicalSort can change to:
> {noformat}
> LogicalProject(D1=[$0]), id = 2284
> LogicalSort(sort0=[$0], dir0=[ASC]), id = 2283
> LogicalProject(D1=[$0], D2=[$0]), id = 2282
> LogicalTableScan(table=[[default, dept]]), id = 2278
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)