Class InSubqueryResolver

java.lang.Object
org.elasticsearch.xpack.esql.analysis.InSubqueryResolver

public class InSubqueryResolver extends Object
Resolves InSubquery expressions in Filter conditions by rewriting them into SemiJoin, AntiJoin, or MarkJoin nodes depending on where the InSubquery sits inside the boolean expression:
  • An InSubquery (optionally wrapped in Not) at the top of an AND-conjunct becomes a row-filtering SemiJoin / AntiJoin stacked on top of the remaining filter — the most efficient shape, used for the common conjunctive case.
  • An InSubquery that appears as a child of Or (or of Not below an Or) is replaced with a synthetic boolean attribute and a MarkJoin is stacked below the rewritten Filter; the mark attribute carries the three-valued IN result up into normal boolean evaluation.
  • An InSubquery wrapped in any other expression (a function argument, an IS NOT NULL, an arithmetic operator, etc.) is left in place; the post-resolution verify(org.elasticsearch.xpack.esql.plan.logical.LogicalPlan) step rejects the query with a VerificationException.

This runs before PreAnalyzer so the subquery plans, originally embedded inside InSubquery expressions, become children of join nodes and visible to standard plan traversals. This eliminates the need for separate InSubquery-aware traversals in PreAnalyzer, FieldNameUtils, and InferenceService.

The join's rightFields are left empty at this stage because the subquery output is not yet resolved. The Analyzer's ResolveRefs fills them in during the Resolution batch.

  • Constructor Details

    • InSubqueryResolver

      public InSubqueryResolver()
  • Method Details