[
https://issues.apache.org/jira/browse/CALCITE-7222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18029269#comment-18029269
]
Zhen Chen commented on CALCITE-7222:
------------------------------------
[~julianhyde] [~zwhtx] I helped modify the JIRA description, please see if it
meets the requirements.
> SortRemoveDuplicateKeysRule miss fetch and offset information
> -------------------------------------------------------------
>
> Key: CALCITE-7222
> URL: https://issues.apache.org/jira/browse/CALCITE-7222
> Project: Calcite
> Issue Type: Bug
> Reporter: weihua zhang
> Assignee: Zhen Chen
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.41.0
>
>
> The current issue is that the FETCH and OFFSET are lost in the SORT after
> this rule transformation. I mistakenly used relBuilder.sort when generating
> the new SORT—it should have been relBuilder.sortLimit .
> The test case is
> {code:java}
> </TestCase>
> <TestCase name="testSortRemoveDuplicateKeysWithLimit">
> <Resource name="sql">
> <![CDATA[select * from (select empno as a, empno as b from emp) t order
> by a, b limit 1 offset 2]]>
> </Resource>
> <Resource name="planBefore">
> <![CDATA[
> LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], offset=[2],
> fetch=[1])
> LogicalProject(A=[$0], B=[$0])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> ]]>
> </Resource>
> <Resource name="planAfter">
> <![CDATA[
> LogicalSort(sort0=[$0], dir0=[ASC]) <--- here missing offset and fetch
> LogicalProject(A=[$0], B=[$0])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> ]]>
> </Resource>
> </TestCase>
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)