mark_join

fn mark_join(
    left: &LogicalPlan,
    subquery: Arc<LogicalPlan>,
    in_predicate_opt: Option<Expr>,
    negated: bool,
    alias_generator: &Arc<AliasGenerator>,
) -> Result<Option<(LogicalPlan, Expr)>>
Expand description

This is used to handle the case when the subquery is embedded in a more complex boolean expression like and OR. For example

select t1.id from t1 where t1.id < 0 OR exists(SELECT t2.id FROM t2 WHERE t1.id = t2.id)

The optimized plan will be:

Projection: t1.id
  Filter: t1.id < 0 OR __correlated_sq_1.mark
    LeftMark Join:  Filter: t1.id = __correlated_sq_1.id
      TableScan: t1
      SubqueryAlias: __correlated_sq_1
        Projection: t2.id
          TableScan: t2