Skip to content

InSubquery Expression

InSubquery is a Predicate that represents the following IN SQL predicate in a logical query plan:

NOT? IN '(' query ')'

InSubquery can also be used internally for other use cases (e.g., Runtime Filtering, Dynamic Partition Pruning).

Creating Instance

InSubquery takes the following to be created:

InSubquery is created when:


InSubquery is an Unevaluable expression.

InSubquery can be converted to a Join operator at logical optimization using RewritePredicateSubquery:

InSubquery can also be converted to InSubqueryExec expression (over a SubqueryExec) in PlanSubqueries physical optimization.

Logical Analysis

InSubquery is resolved using the following logical analysis rules:

Logical Optimization

InSubquery is optimized using the following logical optimizations:

Physical Optimization

InSubquery is optimized using the following physical optimizations:

Catalyst DSL

InSubquery can be created using in operator using Catalyst DSL (via ImplicitOperators).


nodePatterns: Seq[TreePattern]

nodePatterns is part of the TreeNode abstraction.

nodePatterns is IN_SUBQUERY.