Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.30.0
Description
As same as the UNIQUE sub-query, before we convert the sub-query to RelNode. we use the Metadata to optimize it.
EXISTS sub-query, If the sub-query is guaranteed to produce at least one row, just return TRUE. If the sub-query is guaranteed to produce no row, just return FALSE.
For example:
select * from dept as d where EXISTS (select count(*) from emp e where d.deptno = e.deptno)
We can optimize it to:
EnumerableTableScan(table=[[scott, DEPT]])
Attachments
Issue Links
- is related to
-
CALCITE-1583 Wrong results for query with correlated subqueries with aggregate subquery expression
- Open
- relates to
-
CALCITE-6650 Optimize the IN sub-query and SOME sub-query by Metadata RowCount
- Resolved
- links to