|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.ResultSetNode
org.apache.derby.impl.sql.compile.FromTable
org.apache.derby.impl.sql.compile.TableOperatorNode
abstract class TableOperatorNode
A TableOperatorNode represents a relational operator like UNION, INTERSECT, JOIN, etc. that takes two tables as parameters and returns a table. The parameters it takes are represented as ResultSetNodes. Currently, all known table operators are binary operators, so there are no subclasses of this node type called "BinaryTableOperatorNode" and "UnaryTableOperatorNode".
| Field Summary | |
|---|---|
private boolean |
leftModifyAccessPathsDone
|
(package private) Optimizer |
leftOptimizer
|
(package private) ResultSetNode |
leftResultSet
|
private boolean |
rightModifyAccessPathsDone
|
(package private) Optimizer |
rightOptimizer
|
(package private) ResultSetNode |
rightResultSet
|
| Fields inherited from class org.apache.derby.impl.sql.compile.FromTable |
|---|
ADD_PLAN, bestAccessPath, bestCostEstimate, bestSortAvoidancePath, correlationName, corrTableName, currentAccessPath, hashKeyColumns, initialCapacity, level, LOAD_PLAN, loadFactor, maxCapacity, origTableName, REMOVE_PLAN, tableNumber, tableProperties, trulyTheBestAccessPath, userSpecifiedJoinStrategy |
| Fields inherited from class org.apache.derby.impl.sql.compile.ResultSetNode |
|---|
costEstimate, cursorTargetTable, finalCostEstimate, insertSource, optimizer, referencedTableMap, resultColumns, resultSetNumber, scratchCostEstimate, statementResultSet |
| Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
|---|
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired |
| Constructor Summary | |
|---|---|
TableOperatorNode()
|
|
| Method Summary | |
|---|---|
(package private) void |
acceptChildren(Visitor v)
Accept the visitor for all visitable children of this node. |
(package private) void |
adjustForSortElimination()
Notify the underlying result set tree that the optimizer has chosen to "eliminate" a sort. |
(package private) void |
adjustForSortElimination(RequiredRowOrdering rowOrdering)
Same goal as adjustForSortElimination above, but this version takes a RequiredRowOrdering to allow nodes to adjust based on the ORDER BY clause, if needed. |
void |
bindExpressions(FromList fromListParam)
Bind the expressions under this TableOperatorNode. |
void |
bindExpressionsWithTables(FromList fromListParam)
Bind the expressions in this ResultSetNode if it has tables. |
ResultSetNode |
bindNonVTITables(DataDictionary dataDictionary,
FromList fromListParam)
Bind the non VTI tables in this TableOperatorNode. |
void |
bindResultColumns(FromList fromListParam)
Bind the result columns of this ResultSetNode when there is no base table to bind them to. |
void |
bindResultColumns(TableDescriptor targetTableDescriptor,
FromVTI targetVTI,
ResultColumnList targetColumnList,
DMLStatementNode statement,
FromList fromListParam)
Bind the result columns for this ResultSetNode to a base table. |
void |
bindUntypedNullsToResultColumns(ResultColumnList rcl)
DERBY-4365 Bind untyped nulls to the types in the given ResultColumnList. |
ResultSetNode |
bindVTITables(FromList fromListParam)
Bind the VTI tables in this TableOperatorNode. |
(package private) void |
decrementLevel(int decrement)
Decrement (query block) level (0-based) for all of the tables in this ResultSet tree. |
java.lang.String |
getExposedName()
Return the exposed name for this table, which is the name that can be used to refer to this table in the rest of the query. |
protected FromTable |
getFromTableByName(java.lang.String name,
java.lang.String schemaName,
boolean exactMatch)
Determine whether or not the specified name is an exposed name in the current query block. |
ResultSetNode |
getLeftmostResultSet()
|
ResultSetNode |
getLeftResultSet()
Get the leftResultSet from this node. |
ResultSetNode |
getRightResultSet()
Get the rightResultSet from this node. |
void |
init(java.lang.Object leftResultSet,
java.lang.Object rightResultSet,
java.lang.Object tableProperties)
Initializer for a TableOperatorNode. |
Optimizable |
modifyAccessPath(JBitSet outerTables)
Modify the access path for this Optimizable, as necessary. |
ResultSetNode |
modifyAccessPaths()
Modify the access paths according to the decisions the optimizer made. |
boolean |
needsSpecialRCLBinding()
apparently something special needs to be done for me.... |
ResultSetNode |
optimize(DataDictionary dataDictionary,
PredicateList predicateList,
double outerRows)
Optimize a TableOperatorNode. |
protected ResultSetNode |
optimizeSource(Optimizer optimizer,
ResultSetNode sourceResultSet,
PredicateList predList,
CostEstimate outerCost)
Optimize a source result set to this table operator. |
ResultSetNode |
preprocess(int numTables,
GroupByList gbl,
FromList fromList)
Put a ProjectRestrictNode on top of each FromTable in the FromList. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
(package private) void |
projectResultColumns()
Find the unreferenced result columns and project them out. |
boolean |
referencesSessionSchema()
Return true if the node references SESSION schema tables (temporary or permanent) |
boolean |
referencesTarget(java.lang.String name,
boolean baseTable)
Search to see if a query references the specifed table name. |
void |
rejectParameters()
Check for (and reject) ? |
void |
setLeftmostResultSet(ResultSetNode newLeftResultSet)
|
void |
setLevel(int level)
Set the (query block) level (0-based) for this FromTable. |
void |
setNestedInParens(boolean nestedInParens)
Mark whether or not this node is nested in parens. |
(package private) void |
setReferencedColumns()
Set the referenced columns in the column list if it may not be correct. |
java.lang.String |
toString()
Convert this object to a String. |
void |
updateBestPlanMap(short action,
java.lang.Object planKey)
When remembering "truly the best" access path for an Optimizable, we have to keep track of which OptimizerImpl the "truly the best" access is for. |
void |
verifyProperties(DataDictionary dDictionary)
Verify that the Properties list with optimizer overrides, if specified, is valid |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.derby.iapi.sql.compile.Optimizable |
|---|
getDataDictionary, getReferencedTableMap, getResultSetNumber |
| Field Detail |
|---|
ResultSetNode leftResultSet
ResultSetNode rightResultSet
Optimizer leftOptimizer
Optimizer rightOptimizer
private boolean leftModifyAccessPathsDone
private boolean rightModifyAccessPathsDone
| Constructor Detail |
|---|
TableOperatorNode()
| Method Detail |
|---|
public void init(java.lang.Object leftResultSet,
java.lang.Object rightResultSet,
java.lang.Object tableProperties)
throws StandardException
init in interface Nodeinit in class QueryTreeNodeleftResultSet - The ResultSetNode on the left side of this noderightResultSet - The ResultSetNode on the right side of this nodetableProperties - Properties list associated with the table
StandardException - Thrown on error
public void bindUntypedNullsToResultColumns(ResultColumnList rcl)
throws StandardException
bindUntypedNullsToResultColumns in class ResultSetNodercl - The ResultColumnList with the types to bind nulls to
StandardException - Thrown on error
public Optimizable modifyAccessPath(JBitSet outerTables)
throws StandardException
Optimizable
modifyAccessPath in interface OptimizablemodifyAccessPath in class FromTableouterTables - Bit map of the tables that are outer to this one
in the join order.
StandardException - Thrown on errorOptimizable.modifyAccessPath(org.apache.derby.iapi.util.JBitSet)
public void verifyProperties(DataDictionary dDictionary)
throws StandardException
Optimizable
verifyProperties in interface OptimizableverifyProperties in class FromTabledDictionary - The DataDictionary to use.
StandardException - Thrown on errorOptimizable.verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary)
public void updateBestPlanMap(short action,
java.lang.Object planKey)
throws StandardException
Optimizable
updateBestPlanMap in interface OptimizableupdateBestPlanMap in class FromTableaction - Indicates whether we're adding, loading, or removing
a best plan for the OptimizerImpl/Optimizable.planKey - Object to use as the map key when adding/looking up
a plan. If it is an instance of OptimizerImpl then it corresponds
to an outer query; otherwise it's some Optimizable above this
Optimizable that could potentially reject plans chosen by the
OptimizerImpl to which this Optimizable belongs.
StandardExceptionMakes a call to add/load/remove the plan mapping for this node,
and then makes the necessary call to recurse on this node's
left and right child, in order to ensure that we've handled
the full plan all the way down this node's subtree.public java.lang.String toString()
toString in class FromTablepublic void printSubNodes(int depth)
printSubNodes in class ResultSetNodedepth - The depth of this node in the treepublic ResultSetNode getLeftResultSet()
public ResultSetNode getRightResultSet()
public ResultSetNode getLeftmostResultSet()
public void setLeftmostResultSet(ResultSetNode newLeftResultSet)
public void setLevel(int level)
setLevel in class FromTablelevel - The query block level for this FromTable.public java.lang.String getExposedName()
getExposedName in class FromTablepublic void setNestedInParens(boolean nestedInParens)
nestedInParens - Whether or not this node is nested in parens.
public ResultSetNode bindNonVTITables(DataDictionary dataDictionary,
FromList fromListParam)
throws StandardException
bindNonVTITables in class ResultSetNodedataDictionary - The DataDictionary to use for bindingfromListParam - FromList to use/append to.
StandardException - Thrown on error
public ResultSetNode bindVTITables(FromList fromListParam)
throws StandardException
bindVTITables in class ResultSetNodefromListParam - FromList to use/append to.
StandardException - Thrown on error
public void bindExpressions(FromList fromListParam)
throws StandardException
bindExpressions in class ResultSetNodefromListParam - FromList to use/append to.
StandardException - Thrown on error
public void rejectParameters()
throws StandardException
rejectParameters in class ResultSetNodeStandardException - Thrown if a ? parameter found
directly under a ResultColumn
public void bindExpressionsWithTables(FromList fromListParam)
throws StandardException
bindExpressionsWithTables in class ResultSetNodefromListParam - FromList to use/append to.
StandardException - Thrown on error
public void bindResultColumns(FromList fromListParam)
throws StandardException
bindResultColumns in class ResultSetNodefromListParam - FromList to use/append to.
StandardException - Thrown on error
public void bindResultColumns(TableDescriptor targetTableDescriptor,
FromVTI targetVTI,
ResultColumnList targetColumnList,
DMLStatementNode statement,
FromList fromListParam)
throws StandardException
bindResultColumns in class ResultSetNodetargetTableDescriptor - The TableDescriptor for the table being
updated or inserted intotargetColumnList - For INSERT statements, the user
does not have to supply column
names (for example, "insert into t
values (1,2,3)". When this
parameter is null, it means that
the user did not supply column
names, and so the binding should
be done based on order. When it
is not null, it means do the binding
by name, not position.statement - Calling DMLStatementNode (Insert or Update)fromListParam - FromList to use/append to.
StandardException - Thrown on error
protected FromTable getFromTableByName(java.lang.String name,
java.lang.String schemaName,
boolean exactMatch)
throws StandardException
getFromTableByName in class FromTablename - The specified name to search for as an exposed name.schemaName - Schema name, if non-null.exactMatch - Whether or not we need an exact match on specified schema and table
names or match on table id.
StandardException - Thrown on error
public ResultSetNode preprocess(int numTables,
GroupByList gbl,
FromList fromList)
throws StandardException
preprocess in class ResultSetNodenumTables - Number of tables in the DML Statementgbl - The group by list, if anyfromList - The from list, if any
StandardException - Thrown on error
void projectResultColumns()
throws StandardException
projectResultColumns in class ResultSetNodeStandardExceptionvoid setReferencedColumns()
public ResultSetNode optimize(DataDictionary dataDictionary,
PredicateList predicateList,
double outerRows)
throws StandardException
optimize in class ResultSetNodedataDictionary - The DataDictionary to use for optimizationpredicateList - The PredicateList to apply.outerRows - The number of outer joining rows
StandardException - Thrown on error
public ResultSetNode modifyAccessPaths()
throws StandardException
ResultSetNode
modifyAccessPaths in class ResultSetNodeStandardException - Thrown on errorResultSetNode.modifyAccessPaths()
public boolean referencesTarget(java.lang.String name,
boolean baseTable)
throws StandardException
referencesTarget in class ResultSetNodename - Table name (String) to search for.baseTable - Whether or not name is for a base table
StandardException - Thrown on error
public boolean referencesSessionSchema()
throws StandardException
referencesSessionSchema in class QueryTreeNodeStandardException - Thrown on error
protected ResultSetNode optimizeSource(Optimizer optimizer,
ResultSetNode sourceResultSet,
PredicateList predList,
CostEstimate outerCost)
throws StandardException
StandardException - Thrown on errorvoid decrementLevel(int decrement)
decrementLevel in class FromTabledecrement - The amount to decrement by.void adjustForSortElimination()
ResultSetNode
adjustForSortElimination in class ResultSetNodeResultSetNode.adjustForSortElimination()
void adjustForSortElimination(RequiredRowOrdering rowOrdering)
throws StandardException
ResultSetNode
adjustForSortElimination in class ResultSetNodeStandardExceptionResultSetNode.adjustForSortElimination()
void acceptChildren(Visitor v)
throws StandardException
acceptChildren in class ResultSetNodev - the visitor
StandardException - on errorpublic boolean needsSpecialRCLBinding()
needsSpecialRCLBinding in class FromTable
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||