Class SubqueryOperator

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    ExistsOperator, InSubqueryOperator, ScalarSubquery

    public abstract class SubqueryOperator
    extends Expression

    This class is the superclass of all expressions that can hold subqueries, such as the IN operator, the EXISTS operator, and scalar subqueries.

    Subqueries are different from other kinds of expressions in that they require an execution plan to evaluate the subquery expression node. Thus, evaluating the subquery expression requires a recursive invocation of the query evaluator. In general, this recursive invocation approach will be slow for larger queries, and a good planner/optimizer will replace subquery operators with joins, semijoins, etc. wherever it can.

    Note that all subqueries are considered "black boxes" to the expression-traversal mechanism. That is, traversing an expression that contains a subquery will not descend into the subquery's expressions. The reason for this is simple - the subquery may include column-references to schemas that only make sense in the context of the subquery; thus, the subquery should be processed separately from the expression traversal.

    See Also:
    SubquerySchemaComputer
    • Field Detail

      • subquery

        protected SelectClause subquery
        This is the parsed representation of the subquery that the operator uses for its operation.
      • subqueryPlan

        protected PlanNode subqueryPlan
        The execution plan for the subquery that is used by the operator. This will be null until the subquery has actually been analyzed and planned by the query planner.
    • Constructor Detail

      • SubqueryOperator

        public SubqueryOperator()
    • Method Detail

      • getSubquery

        public SelectClause getSubquery()
        Returns the parsed representation of the subquery that is used by this operator.
        Returns:
        the parsed representation of the subquery that is used by this operator.
      • setSubqueryPlan

        public void setSubqueryPlan​(PlanNode plan)
        Sets the execution plan for evaluating the subquery.
        Parameters:
        plan - the execution plan for evaluating the subquery.
      • getSubqueryPlan

        public PlanNode getSubqueryPlan()
        Retrieves the current execution plan for the subquery.
        Returns:
        the current execution plan for the subquery.