Package edu.caltech.nanodb.queryast
Class SubquerySchemaComputer
- java.lang.Object
-
- edu.caltech.nanodb.queryast.SubquerySchemaComputer
-
- All Implemented Interfaces:
ExpressionProcessor
class SubquerySchemaComputer extends java.lang.Object implements ExpressionProcessor
This expression-processor implementation looks for subqueries within an expression, and calls the
SelectClause.computeSchema(edu.caltech.nanodb.storage.TableManager, edu.caltech.nanodb.queryast.SelectClause)
method on them. The enclosing query is passed as an argument, in case subqueries are correlated with the enclosing query.Note that this traversal mechanism will only identify the subqueries that are immediately nested within this query; if a subquery itself has subqueries, those will not be identified by this class, but rather will be processed when the subquery's schema is computed.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
found
A flag used to track whether subqueries were found while traversing the expression tree.private static org.apache.logging.log4j.Logger
logger
A logging object for reporting anything interesting that happens.private SelectClause
selectClause
This is the parent query that may contain subqueries.private TableManager
tableManager
This is the table-manager used to access table schemas.
-
Constructor Summary
Constructors Constructor Description SubquerySchemaComputer(SelectClause selectClause, TableManager tableManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearFoundFlag()
void
enter(Expression e)
This method identifiesSubqueryOperator
objects, retrieves the subquery, and then generates a plan for the subquery.boolean
foundSubqueries()
Expression
leave(Expression e)
This method is a no-op for this expression processor.
-
-
-
Field Detail
-
logger
private static org.apache.logging.log4j.Logger logger
A logging object for reporting anything interesting that happens.
-
selectClause
private SelectClause selectClause
This is the parent query that may contain subqueries.
-
tableManager
private TableManager tableManager
This is the table-manager used to access table schemas.
-
found
private boolean found
A flag used to track whether subqueries were found while traversing the expression tree.
-
-
Constructor Detail
-
SubquerySchemaComputer
public SubquerySchemaComputer(SelectClause selectClause, TableManager tableManager)
-
-
Method Detail
-
enter
public void enter(Expression e)
This method identifiesSubqueryOperator
objects, retrieves the subquery, and then generates a plan for the subquery.- Specified by:
enter
in interfaceExpressionProcessor
- Parameters:
e
- the expression node being entered
-
leave
public Expression leave(Expression e)
This method is a no-op for this expression processor.- Specified by:
leave
in interfaceExpressionProcessor
- Parameters:
e
- the expression node being left- Returns:
- the passed-in expression
e
.
-
foundSubqueries
public boolean foundSubqueries()
-
clearFoundFlag
public void clearFoundFlag()
-
-