Class TransformCorrelatedInPredicateToJoin

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

public class TransformCorrelatedInPredicateToJoin extends Object implements Rule<ApplyNode>
Replaces correlated ApplyNode with InPredicate expression with SemiJoin

Transforms:

 - Apply (output: a in B.b)
    - input: some plan A producing symbol a
    - subquery: some plan B producing symbol b, using symbols from A
 
Into:
 - Project (output: CASE WHEN (countmatches > 0) THEN true WHEN (countnullmatches > 0) THEN null ELSE false END)
   - Aggregate (countmatches=count(*) where a, b not null; countnullmatches where (a is null or b is null) but buildSideKnownNonNull is not null)
     grouping by (A'.*)
     - LeftJoin on (a = B.b, A and B correlation condition)
       - AssignUniqueId (A')
         - A
 
See Also: