Package edu.caltech.nanodb.queryeval
Interface Planner
-
- All Known Implementing Classes:
CostBasedJoinPlanner
,SimplestPlanner
public interface Planner
This interface specifies the common entry-point for all query planner/optimizer implementations. The interface is very simple, but a particular implementation might be very complicated depending on what kinds of optimizations are implemented. Note that a new planner/optimizer is created for each query being planned.
To support initialization of arbitrary planners, a
Planner
implementation should only have a default constructor.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PlanNode
makePlan(SelectClause selClause, java.util.List<SelectClause> enclosingSelects)
Returns the root of a plan tree suitable for executing the specified query.SelectNode
makeSimpleSelect(java.lang.String tableName, Expression predicate, java.util.List<SelectClause> enclosingSelects)
Returns a plan tree for executing a simple select against a single table, whose tuples can also be used for updating and deletion.void
setStorageManager(StorageManager storageManager)
Allows the storage manager to be injected into the planner implementation, so that the planner can retrieve schema and statistics on tables that are referenced by the query.
-
-
-
Method Detail
-
setStorageManager
void setStorageManager(StorageManager storageManager)
Allows the storage manager to be injected into the planner implementation, so that the planner can retrieve schema and statistics on tables that are referenced by the query.- Parameters:
storageManager
- the storage manager instance for the planner implementation to use
-
makePlan
PlanNode makePlan(SelectClause selClause, java.util.List<SelectClause> enclosingSelects)
Returns the root of a plan tree suitable for executing the specified query. There is no requirement that tuples produced by the returned plan should support updating or deletion.- Parameters:
selClause
- an object describing the query to be performedenclosingSelects
- a list of enclosing queries, ifselClause
is a nested subquery. This is allowed to be an empty list, ornull
, if the query is a top-level query. IfselClause
is a nested subquery,enclosingSelects[0]
is the outermost enclosing query, thenenclosingSelects[1]
is enclosed byenclosingSelects[0]
, and so forth. The most tightly enclosing query is the last one inenclosingSelects
.- Returns:
- a plan tree for executing the specified query
-
makeSimpleSelect
SelectNode makeSimpleSelect(java.lang.String tableName, Expression predicate, java.util.List<SelectClause> enclosingSelects)
Returns a plan tree for executing a simple select against a single table, whose tuples can also be used for updating and deletion. This is a strict requirement, as this method is used by theUpdateCommand
andDeleteCommand
classes to create the plans suitable for performing tuple modification or deletion.- Parameters:
tableName
- the table that the select will operate againstpredicate
- the selection predicate to apply, ornull
if all tuples in the table should be returnedenclosingSelects
- a list of enclosing queries, ifselClause
is a nested subquery. This is allowed to be an empty list, ornull
, if the query is a top-level query. IfselClause
is a nested subquery,enclosingSelects[0]
is the outermost enclosing query, thenenclosingSelects[1]
is enclosed byenclosingSelects[0]
, and so forth. The most tightly enclosing query is the last one inenclosingSelects
.- Returns:
- a plan tree for executing the select operation
-
-