Class TransformExistsApplyToCorrelatedJoin

java.lang.Object
io.trino.sql.planner.iterative.rule.TransformExistsApplyToCorrelatedJoin
All Implemented Interfaces:
Rule<ApplyNode>

public class TransformExistsApplyToCorrelatedJoin extends Object implements Rule<ApplyNode>
EXISTS is modeled as (if correlated predicates are equality comparisons):
     - Project(exists := COALESCE(subqueryTrue, false))
       - CorrelatedJoin(LEFT)
         - input
         - Project(subqueryTrue := true)
           - Limit(count=1)
             - subquery
 
or:
     - CorrelatedJoin(LEFT)
       - input
       - Project($0 > 0)
         - Aggregation(COUNT(*))
           - subquery
 
otherwise