Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.25.0
Description
For query
SELECT deptno, ename FROM (SELECT DISTINCT deptno FROM emp) t1, LATERAL ( SELECT ename, sal FROM emp WHERE deptno = t1.deptno ORDER BY sal DESC LIMIT 3 )
The current plan after decorrelation is
LogicalProject(DEPTNO=[$0], ENAME=[$1]) LogicalJoin(condition=[=($0, $3)], joinType=[inner]) LogicalAggregate(group=[{0}]) LogicalProject(DEPTNO=[$7]) LogicalTableScan(table=[[CATALOG, SALES, EMP]]) LogicalSort(sort0=[$1], dir0=[DESC], fetch=[3]) LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7]) LogicalTableScan(table=[[CATALOG, SALES, EMP]])
which is wrong, because the partition sort(on sal) changes to global.
Attachments
Issue Links
- causes
-
CALCITE-4333 The Sort rel should be decorrelated even though it has fetch or limit when its parent is not a Correlate
-
- Closed
-
-
CALCITE-4437 The Sort rel should be decorrelated even though it has fetch or limit when it is not inside a Correlate
-
- Closed
-
- links to