|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.sql.compile
Class TableOperatorNode

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
- All Implemented Interfaces:
- org.apache.derby.iapi.sql.compile.Optimizable, org.apache.derby.iapi.sql.compile.Visitable
- Direct Known Subclasses:
- JoinNode, SetOperatorNode
- public abstract class TableOperatorNode
- extends FromTable
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) org.apache.derby.iapi.sql.compile.Optimizer |
leftOptimizer
|
(package private) ResultSetNode |
leftResultSet
|
(package private) boolean |
nestedInParens
|
private boolean |
rightModifyAccessPathsDone
|
(package private) org.apache.derby.iapi.sql.compile.Optimizer |
rightOptimizer
|
(package private) ResultSetNode |
rightResultSet
|
| Fields inherited from class org.apache.derby.impl.sql.compile.FromTable |
bestAccessPath, bestCostEstimate, bestSortAvoidancePath, correlationName, corrTableName, currentAccessPath, hashKeyColumns, initialCapacity, level, loadFactor, maxCapacity, tableNumber, tableProperties, trulyTheBestAccessPath, userSpecifiedJoinStrategy |
| Fields inherited from class org.apache.derby.impl.sql.compile.ResultSetNode |
costEstimate, cursorTargetTable, insertSource, optimizer, referencedTableMap, resultColumns, resultSetNumber, scratchCostEstimate, statementResultSet |
| Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset |
| Constructor Summary | |
TableOperatorNode()
|
|
| Method Summary | |
org.apache.derby.iapi.sql.compile.Visitable |
accept(org.apache.derby.iapi.sql.compile.Visitor v)
Accept a visitor, and call v.visit() on child nodes as necessary. |
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(org.apache.derby.iapi.sql.dictionary.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(org.apache.derby.iapi.sql.dictionary.TableDescriptor targetTableDescriptor,
FromVTI targetVTI,
ResultColumnList targetColumnList,
DMLStatementNode statement,
FromList fromListParam)
Bind the result columns for this ResultSetNode to a base table. |
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. |
boolean |
getNestedInParens()
Return whether or not the table operator for this node was nested in parens in the query. |
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. |
(package private) void |
markOrderingDependent()
Notify the underlying result set tree that the result is ordering dependent. |
org.apache.derby.iapi.sql.compile.Optimizable |
modifyAccessPath(org.apache.derby.iapi.util.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(org.apache.derby.iapi.sql.dictionary.DataDictionary dataDictionary,
PredicateList predicateList,
double outerRows)
Optimize a TableOperatorNode. |
protected ResultSetNode |
optimizeSource(org.apache.derby.iapi.sql.compile.Optimizer optimizer,
ResultSetNode sourceResultSet,
PredicateList predList,
org.apache.derby.iapi.sql.compile.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) ? parameters directly under the ResultColumns. |
(package private) void |
replaceDefaults(org.apache.derby.iapi.sql.dictionary.TableDescriptor ttd,
ResultColumnList tcl)
Replace any DEFAULTs with the associated tree for the default. |
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 |
verifyProperties(org.apache.derby.iapi.sql.dictionary.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 |
nestedInParens
boolean nestedInParens
leftResultSet
ResultSetNode leftResultSet
rightResultSet
ResultSetNode rightResultSet
leftOptimizer
org.apache.derby.iapi.sql.compile.Optimizer leftOptimizer
rightOptimizer
org.apache.derby.iapi.sql.compile.Optimizer rightOptimizer
leftModifyAccessPathsDone
private boolean leftModifyAccessPathsDone
rightModifyAccessPathsDone
private boolean rightModifyAccessPathsDone
| Constructor Detail |
TableOperatorNode
public TableOperatorNode()
| Method Detail |
init
public void init(java.lang.Object leftResultSet, java.lang.Object rightResultSet, java.lang.Object tableProperties) throws org.apache.derby.iapi.error.StandardException
- Initializer for a TableOperatorNode.
- Overrides:
initin classQueryTreeNode
modifyAccessPath
public org.apache.derby.iapi.sql.compile.Optimizable modifyAccessPath(org.apache.derby.iapi.util.JBitSet outerTables) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.sql.compile.Optimizable - Modify the access path for this Optimizable, as necessary. This includes
things like adding a result set to translate from index rows to base rows
- Specified by:
modifyAccessPathin interfaceorg.apache.derby.iapi.sql.compile.Optimizable- Overrides:
modifyAccessPathin classFromTable
verifyProperties
public void verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary dDictionary) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.sql.compile.Optimizable - Verify that the Properties list with optimizer overrides, if specified, is valid
- Specified by:
verifyPropertiesin interfaceorg.apache.derby.iapi.sql.compile.Optimizable- Overrides:
verifyPropertiesin classFromTable
toString
public java.lang.String toString()
- Convert this object to a String. See comments in QueryTreeNode.java
for how this should be done for tree printing.
printSubNodes
public void printSubNodes(int depth)
- Prints the sub-nodes of this object. See QueryTreeNode.java for
how tree printing is supposed to work.
- Overrides:
printSubNodesin classResultSetNode
getLeftResultSet
public ResultSetNode getLeftResultSet()
- Get the leftResultSet from this node.
getRightResultSet
public ResultSetNode getRightResultSet()
- Get the rightResultSet from this node.
getLeftmostResultSet
public ResultSetNode getLeftmostResultSet()
setLeftmostResultSet
public void setLeftmostResultSet(ResultSetNode newLeftResultSet)
setLevel
public void setLevel(int level)
getExposedName
public 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.
- Overrides:
getExposedNamein classFromTable
setNestedInParens
public void setNestedInParens(boolean nestedInParens)
- Mark whether or not this node is nested in parens. (Useful to parser
since some trees get created left deep and others right deep.)
getNestedInParens
public boolean getNestedInParens()
- Return whether or not the table operator for this node was
nested in parens in the query. (Useful to parser
since some trees get created left deep and others right deep.)
bindNonVTITables
public ResultSetNode bindNonVTITables(org.apache.derby.iapi.sql.dictionary.DataDictionary dataDictionary, FromList fromListParam) throws org.apache.derby.iapi.error.StandardException
- Bind the non VTI tables in this TableOperatorNode. This means getting
their TableDescriptors from the DataDictionary.
We will build an unbound RCL for this node. This RCL must be
"bound by hand" after the underlying left and right RCLs
are bound.
- Overrides:
bindNonVTITablesin classResultSetNode
bindVTITables
public ResultSetNode bindVTITables(FromList fromListParam) throws org.apache.derby.iapi.error.StandardException
- Bind the VTI tables in this TableOperatorNode. This means getting
their TableDescriptors from the DataDictionary.
We will build an unbound RCL for this node. This RCL must be
"bound by hand" after the underlying left and right RCLs
are bound.
- Overrides:
bindVTITablesin classResultSetNode
bindExpressions
public void bindExpressions(FromList fromListParam) throws org.apache.derby.iapi.error.StandardException
- Bind the expressions under this TableOperatorNode. This means
binding the sub-expressions, as well as figuring out what the
return type is for each expression.
- Overrides:
bindExpressionsin classResultSetNode
rejectParameters
public void rejectParameters()
throws org.apache.derby.iapi.error.StandardException
- Check for (and reject) ? parameters directly under the ResultColumns.
This is done for SELECT statements. For TableOperatorNodes, we
simply pass the check through to the left and right children.
- Overrides:
rejectParametersin classResultSetNode
bindExpressionsWithTables
public void bindExpressionsWithTables(FromList fromListParam) throws org.apache.derby.iapi.error.StandardException
- Bind the expressions in this ResultSetNode if it has tables. This means binding the
sub-expressions, as well as figuring out what the return type is for
each expression.
- Overrides:
bindExpressionsWithTablesin classResultSetNode
bindResultColumns
public void bindResultColumns(FromList fromListParam) throws org.apache.derby.iapi.error.StandardException
- Bind the result columns of this ResultSetNode when there is no
base table to bind them to. This is useful for SELECT statements,
where the result columns get their types from the expressions that
live under them.
- Overrides:
bindResultColumnsin classResultSetNode
bindResultColumns
public void bindResultColumns(org.apache.derby.iapi.sql.dictionary.TableDescriptor targetTableDescriptor, FromVTI targetVTI, ResultColumnList targetColumnList, DMLStatementNode statement, FromList fromListParam) throws org.apache.derby.iapi.error.StandardException
- Bind the result columns for this ResultSetNode to a base table.
This is useful for INSERT and UPDATE statements, where the
result columns get their types from the table being updated or
inserted into.
If a result column list is specified, then the verification that the
result column list does not contain any duplicates will be done when
binding them by name.
- Overrides:
bindResultColumnsin classResultSetNode
getFromTableByName
protected FromTable getFromTableByName(java.lang.String name, java.lang.String schemaName, boolean exactMatch) throws org.apache.derby.iapi.error.StandardException
- Determine whether or not the specified name is an exposed name in
the current query block.
- Overrides:
getFromTableByNamein classFromTable
preprocess
public ResultSetNode preprocess(int numTables, GroupByList gbl, FromList fromList) throws org.apache.derby.iapi.error.StandardException
- Put a ProjectRestrictNode on top of each FromTable in the FromList.
ColumnReferences must continue to point to the same ResultColumn, so
that ResultColumn must percolate up to the new PRN. However,
that ResultColumn will point to a new expression, a VirtualColumnNode,
which points to the FromTable and the ResultColumn that is the source for
the ColumnReference.
(The new PRN will have the original of the ResultColumnList and
the ResultColumns from that list. The FromTable will get shallow copies
of the ResultColumnList and its ResultColumns. ResultColumn.expression
will remain at the FromTable, with the PRN getting a new
VirtualColumnNode for each ResultColumn.expression.)
We then project out the non-referenced columns. If there are no referenced
columns, then the PRN's ResultColumnList will consist of a single ResultColumn
whose expression is 1.
- Overrides:
preprocessin classResultSetNode
projectResultColumns
void projectResultColumns()
throws org.apache.derby.iapi.error.StandardException
- Find the unreferenced result columns and project them out. This is used in pre-processing joins
that are not flattened into the where clause.
- Overrides:
projectResultColumnsin classResultSetNode
setReferencedColumns
void setReferencedColumns()
- Set the referenced columns in the column list if it may not be correct.
optimize
public ResultSetNode optimize(org.apache.derby.iapi.sql.dictionary.DataDictionary dataDictionary, PredicateList predicateList, double outerRows) throws org.apache.derby.iapi.error.StandardException
- Optimize a TableOperatorNode.
- Overrides:
optimizein classResultSetNode
modifyAccessPaths
public ResultSetNode modifyAccessPaths() throws org.apache.derby.iapi.error.StandardException
- Description copied from class:
ResultSetNode - Modify the access paths according to the decisions the optimizer
made. This can include adding project/restrict nodes,
index-to-base-row nodes, etc.
- Overrides:
modifyAccessPathsin classResultSetNode
referencesTarget
public boolean referencesTarget(java.lang.String name, boolean baseTable) throws org.apache.derby.iapi.error.StandardException
- Search to see if a query references the specifed table name.
- Overrides:
referencesTargetin classResultSetNode
referencesSessionSchema
public boolean referencesSessionSchema()
throws org.apache.derby.iapi.error.StandardException
- Return true if the node references SESSION schema tables (temporary or permanent)
- Overrides:
referencesSessionSchemain classQueryTreeNode
optimizeSource
protected ResultSetNode optimizeSource(org.apache.derby.iapi.sql.compile.Optimizer optimizer, ResultSetNode sourceResultSet, PredicateList predList, org.apache.derby.iapi.sql.compile.CostEstimate outerCost) throws org.apache.derby.iapi.error.StandardException
- Optimize a source result set to this table operator.
decrementLevel
void decrementLevel(int decrement)
- Decrement (query block) level (0-based) for
all of the tables in this ResultSet tree.
This is useful when flattening a subquery.
- Overrides:
decrementLevelin classFromTable
replaceDefaults
void replaceDefaults(org.apache.derby.iapi.sql.dictionary.TableDescriptor ttd, ResultColumnList tcl) throws org.apache.derby.iapi.error.StandardException
- Replace any DEFAULTs with the associated tree for the default.
- Overrides:
replaceDefaultsin classResultSetNode
markOrderingDependent
void markOrderingDependent()
- Notify the underlying result set tree that the result is
ordering dependent. (For example, no bulk fetch on an index
if under an IndexRowToBaseRow.)
- Overrides:
markOrderingDependentin classResultSetNode
accept
public org.apache.derby.iapi.sql.compile.Visitable accept(org.apache.derby.iapi.sql.compile.Visitor v) throws org.apache.derby.iapi.error.StandardException
- Accept a visitor, and call v.visit()
on child nodes as necessary.
- Specified by:
acceptin interfaceorg.apache.derby.iapi.sql.compile.Visitable- Overrides:
acceptin classResultSetNode
needsSpecialRCLBinding
public boolean needsSpecialRCLBinding()
- apparently something special needs to be done for me....
- Overrides:
needsSpecialRCLBindingin classFromTable
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC