Class SubqueryOperator
- java.lang.Object
-
- edu.caltech.nanodb.expressions.Expression
-
- edu.caltech.nanodb.expressions.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 Summary
Fields Modifier and Type Field Description protected SelectClause
subquery
This is the parsed representation of the subquery that the operator uses for its operation.protected PlanNode
subqueryPlan
The execution plan for the subquery that is used by the operator.
-
Constructor Summary
Constructors Constructor Description SubqueryOperator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SelectClause
getSubquery()
Returns the parsed representation of the subquery that is used by this operator.PlanNode
getSubqueryPlan()
Retrieves the current execution plan for the subquery.void
setSubqueryPlan(PlanNode plan)
Sets the execution plan for evaluating the subquery.-
Methods inherited from class edu.caltech.nanodb.expressions.Expression
clone, duplicate, equals, evaluate, evaluate, evaluatePredicate, evaluatePredicate, getAllSymbols, getColumnInfo, hashCode, hasSymbols, simplify, traverse
-
-
-
-
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 benull
until the subquery has actually been analyzed and planned by the query planner.
-
-
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.
-
-