Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
class SqlToRelConverterTest extends SqlToRelTestBase { ... @Test void testInCorrelatedSubQueryInHavingRex() { final String sql = "select sum(sal) as s\n" + "from emp e1\n" + "group by deptno\n" + "having count(*) > 2\n" + "and exists(\n" + " select true\n" + " from emp e2\n" + " where e1.deptno = e2.deptno)"; sql(sql).withExpand(false).ok(); }
Generates the following plan where the project with a subquery does not have correlate id:
LogicalProject(S=[$1]) LogicalFilter(condition=[AND(>($2, 2), EXISTS({ LogicalFilter(condition=[=($cor0.DEPTNO, $7)]) LogicalTableScan(table=[[CATALOG, SALES, EMP]]) }))]) LogicalAggregate(group=[{0}], S=[SUM($1)], agg#1=[COUNT()]) LogicalProject(DEPTNO=[$7], SAL=[$5]) LogicalTableScan(table=[[CATALOG, SALES, EMP]])
Attachments
Issue Links
- is related to
-
CALCITE-5418 Nested Queries are not expanded properly
- Open
-
CALCITE-5420 SqlToRel should populate the correlate id of a Project for queries with aggregates
- Open