The strategy for the four types of exists subqueries this class will flatten:
This predicate determines if we attempt to flatten a given exists SubqueryNode or not.
Determines if the where clause of an exists subquery is one that we can flatten.
J / \ J Z / \ J A / \ B CWhere the top join is an INNER join that emits at most one row for each matching row for join predicate z1=a1; NOT-EXISTS: select * from A join B on a1=b1 join C on b1=c1 where EXISTS(select 1 from Z where z1=a1);
J / \ J Z / \ J A / \ B CWhere the top join is an LEFT OUTER join that emits one row on the left when there is no matching row on the right. In practice Z is often multiple tables. We currently place a distinct node above Z do prevent duplicate rows.