Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
None
-
None
-
None
-
None
Description
Lost sort in subquery when converting a SqlNode to Relnode, making its semantics changed.
The test case to reproduce
// SqlToRelConverterTest @Test public void testSortInSubquery() { final String sql = "select ename from (select ename from emp order by ename) a"; sql(sql).ok(); }
This test case will success with this plan.
<TestCase name="testSortInSubquery"> <Resource name="sql"> <![CDATA[select ename from (select ename from emp order by ename) a]]> </Resource> <Resource name="plan"> <![CDATA[ LogicalProject(ENAME=[$1]) LogicalTableScan(table=[[CATALOG, SALES, EMP]]) ]]> </Resource> </TestCase>
Attachments
Issue Links
- duplicates
-
CALCITE-4160 Add configuration to retain ORDER BY in sub-query
- Closed
- is related to
-
CALCITE-2798 Optimizer should remove ORDER BY in sub-query, provided it has no LIMIT or OFFSET
- Closed