org.apache.derby.impl.sql.compile
Class TableOperatorNode

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.QueryTreeNode
      extended by org.apache.derby.impl.sql.compile.ResultSetNode
          extended by org.apache.derby.impl.sql.compile.FromTable
              extended by org.apache.derby.impl.sql.compile.TableOperatorNode
All Implemented Interfaces:
Optimizable, Visitable
Direct Known Subclasses:
JoinNode, SetOperatorNode

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)  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 org.apache.derby.impl.sql.compile.FromTable
assignCostEstimate, canBeOrdered, considerSortAvoidancePath, convertAbsoluteToRelativeColumnPosition, cursorTargetTable, estimateCost, feasibleJoinStrategy, fillInReferencedTableMap, flatten, forUpdate, getBaseTableName, getBestAccessPath, getBestSortAvoidancePath, getCorrelationName, getCostEstimate, getCurrentAccessPath, getFinalCostEstimate, getLevel, getName, getNumColumnsReturned, getOrigTableName, getProperties, getResultColumnsForList, getSchemaDescriptor, getSchemaDescriptor, getScratchCostEstimate, getTableDescriptor, getTableName, getTableNumber, getTrulyTheBestAccessPath, getUserSpecifiedJoinStrategy, hashKeyColumns, hasTableNumber, init, initAccessPaths, initialCapacity, isBaseTable, isCoveringIndex, isFlattenableJoinNode, isMaterializable, isOneRowScan, isTargetTable, legalJoinOrder, loadFactor, LOJ_reorderable, markUpdatableByCursor, maxCapacity, memoryUsageOK, nextAccessPath, optimizeIt, optimizeSubqueries, pullOptPredicates, pushExpressions, pushOptPredicate, rememberAsBest, rememberJoinStrategyAsBest, rememberSortAvoidancePath, resetJoinStrategies, setCostEstimate, setHashKeyColumns, setOrigTableName, setProperties, setTableNumber, startOptimizing, supportsMultipleInstantiations, tellRowOrderingAboutConstantColumns, transformOuterJoins, uniqueJoin
 
Methods inherited from class org.apache.derby.impl.sql.compile.ResultSetNode
addNewPredicate, assignResultSetNumber, bindTargetExpressions, changeAccessPath, columnTypesAndLengthsMatch, considerMaterialization, disablePrivilegeCollection, enhanceRCLForInsert, ensurePredicateList, flattenableInFromSubquery, generateNormalizationResultSet, generateResultSet, genProjectRestrict, genProjectRestrict, genProjectRestrictForReordering, getAllResultColumns, getCostEstimate, getCursorTargetTable, getFromList, getMatchingColumn, getNewCostEstimate, getOptimizer, getOptimizerImpl, getRCLForInsert, getReferencedTableMap, getResultColumns, getResultSetNumber, isNotExists, isOneRowResultSet, isOrderedOn, isPossibleDistinctScan, isUpdatableCursor, LOJgetReferencedTables, makeResultDescription, makeResultDescriptors, markAsCursorTargetTable, markForDistinctScan, markStatementResultSet, modifyAccessPaths, notCursorTargetTable, notFlattenableJoin, numDistinctAggregates, parseDefault, performMaterialization, pushOffsetFetchFirst, pushOrderByList, rejectXMLValues, renameGeneratedResultNames, replaceOrForbidDefaults, returnsAtMostOneRow, setInsertSource, setReferencedTableMap, setResultColumns, setResultToBooleanTrueNode, setTableConstructorTypes, subqueryReferencesTarget, updateTargetLockMode, verifySelectStarSubquery
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bindOffsetFetch, bindRowMultiSet, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, formatNodeString, foundString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, treePrint, treePrint, verifyClassExist
 
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

leftResultSet

ResultSetNode leftResultSet

rightResultSet

ResultSetNode rightResultSet

leftOptimizer

Optimizer leftOptimizer

rightOptimizer

Optimizer rightOptimizer

leftModifyAccessPathsDone

private boolean leftModifyAccessPathsDone

rightModifyAccessPathsDone

private boolean rightModifyAccessPathsDone
Constructor Detail

TableOperatorNode

TableOperatorNode()
Method Detail

init

public void init(java.lang.Object leftResultSet,
                 java.lang.Object rightResultSet,
                 java.lang.Object tableProperties)
          throws StandardException
Initializer for a TableOperatorNode.

Overrides:
init in class QueryTreeNode
Parameters:
leftResultSet - The ResultSetNode on the left side of this node
rightResultSet - The ResultSetNode on the right side of this node
tableProperties - Properties list associated with the table
Throws:
StandardException - Thrown on error

bindUntypedNullsToResultColumns

public void bindUntypedNullsToResultColumns(ResultColumnList rcl)
                                     throws StandardException
DERBY-4365 Bind untyped nulls to the types in the given ResultColumnList. This is used for binding the nulls in row constructors and table constructors.

Overrides:
bindUntypedNullsToResultColumns in class ResultSetNode
Parameters:
rcl - The ResultColumnList with the types to bind nulls to
Throws:
StandardException - Thrown on error

modifyAccessPath

public Optimizable modifyAccessPath(JBitSet outerTables)
                             throws StandardException
Description copied from interface: 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:
modifyAccessPath in interface Optimizable
Overrides:
modifyAccessPath in class FromTable
Parameters:
outerTables - Bit map of the tables that are outer to this one in the join order.
Returns:
The (potentially new) Optimizable at the top of the tree.
Throws:
StandardException - Thrown on error
See Also:
Optimizable.modifyAccessPath(org.apache.derby.iapi.util.JBitSet)

verifyProperties

public void verifyProperties(DataDictionary dDictionary)
                      throws StandardException
Description copied from interface: Optimizable
Verify that the Properties list with optimizer overrides, if specified, is valid

Specified by:
verifyProperties in interface Optimizable
Overrides:
verifyProperties in class FromTable
Parameters:
dDictionary - The DataDictionary to use.
Throws:
StandardException - Thrown on error
See Also:
Optimizable.verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary)

updateBestPlanMap

public void updateBestPlanMap(short action,
                              java.lang.Object planKey)
                       throws StandardException
Description copied from interface: Optimizable
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. In most queries there will only be one OptimizerImpl in question, but in cases where there are nested subqueries, there will be one OptimizerImpl for every level of nesting, and each OptimizerImpl might have its own idea of what this Optimizable's "truly the best path" access path really is. In addition, there could be Optimizables above this Optimizable that might need to override the best path chosen during optimization. So whenever we save a "truly the best" path, we take note of which Optimizer/Optimizable told us to do so. Then as each level of subquery finishes optimization, the corresponding OptimizerImpl/Optimizable can load its preferred access path into this Optimizable's trulyTheBestAccessPath field and pass it up the tree, until eventually the outer-most OptimizerImpl can choose to either use the best path that it received from below (by calling "rememberAsBest()") or else use the path that it found to be "best" for itself. This method is what allows us to keep track of which OptimizerImpl or Optimizable saved which "best plan", and allows us to load the appropriate plans after each round of optimization.

Specified by:
updateBestPlanMap in interface Optimizable
Overrides:
updateBestPlanMap in class FromTable
Parameters:
action - 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.
Throws:
StandardException
See Also:
Makes 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.

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.

Overrides:
toString in class FromTable
Returns:
This object as a String

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:
printSubNodes in class ResultSetNode
Parameters:
depth - The depth of this node in the tree

getLeftResultSet

public ResultSetNode getLeftResultSet()
Get the leftResultSet from this node.

Returns:
ResultSetNode The leftResultSet from this node.

getRightResultSet

public ResultSetNode getRightResultSet()
Get the rightResultSet from this node.

Returns:
ResultSetNode The rightResultSet from this node.

getLeftmostResultSet

public ResultSetNode getLeftmostResultSet()

setLeftmostResultSet

public void setLeftmostResultSet(ResultSetNode newLeftResultSet)

setLevel

public void setLevel(int level)
Set the (query block) level (0-based) for this FromTable.

Overrides:
setLevel in class FromTable
Parameters:
level - The query block level for this FromTable.

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:
getExposedName in class FromTable
Returns:
The exposed name for this table.

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.) The resulting state of this cal was never used so its field was removed to save runtimespace for this node. Further cleanup can be done including parser changes if this call is really nor required.

Parameters:
nestedInParens - Whether or not this node is nested in parens.

bindNonVTITables

public ResultSetNode bindNonVTITables(DataDictionary dataDictionary,
                                      FromList fromListParam)
                               throws 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:
bindNonVTITables in class ResultSetNode
Parameters:
dataDictionary - The DataDictionary to use for binding
fromListParam - FromList to use/append to.
Returns:
ResultSetNode Returns this.
Throws:
StandardException - Thrown on error

bindVTITables

public ResultSetNode bindVTITables(FromList fromListParam)
                            throws 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:
bindVTITables in class ResultSetNode
Parameters:
fromListParam - FromList to use/append to.
Returns:
ResultSetNode Returns this.
Throws:
StandardException - Thrown on error

bindExpressions

public void bindExpressions(FromList fromListParam)
                     throws 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:
bindExpressions in class ResultSetNode
Parameters:
fromListParam - FromList to use/append to.
Throws:
StandardException - Thrown on error

rejectParameters

public void rejectParameters()
                      throws 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:
rejectParameters in class ResultSetNode
Throws:
StandardException - Thrown if a ? parameter found directly under a ResultColumn

bindExpressionsWithTables

public void bindExpressionsWithTables(FromList fromListParam)
                               throws 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:
bindExpressionsWithTables in class ResultSetNode
Parameters:
fromListParam - FromList to use/append to.
Throws:
StandardException - Thrown on error

bindResultColumns

public void bindResultColumns(FromList fromListParam)
                       throws 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:
bindResultColumns in class ResultSetNode
Parameters:
fromListParam - FromList to use/append to.
Throws:
StandardException - Thrown on error

bindResultColumns

public void bindResultColumns(TableDescriptor targetTableDescriptor,
                              FromVTI targetVTI,
                              ResultColumnList targetColumnList,
                              DMLStatementNode statement,
                              FromList fromListParam)
                       throws 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:
bindResultColumns in class ResultSetNode
Parameters:
targetTableDescriptor - The TableDescriptor for the table being updated or inserted into
targetColumnList - 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.
Throws:
StandardException - Thrown on error

getFromTableByName

protected FromTable getFromTableByName(java.lang.String name,
                                       java.lang.String schemaName,
                                       boolean exactMatch)
                                throws StandardException
Determine whether or not the specified name is an exposed name in the current query block.

Overrides:
getFromTableByName in class FromTable
Parameters:
name - 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.
Returns:
The FromTable, if any, with the exposed name.
Throws:
StandardException - Thrown on error

preprocess

public ResultSetNode preprocess(int numTables,
                                GroupByList gbl,
                                FromList fromList)
                         throws 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:
preprocess in class ResultSetNode
Parameters:
numTables - Number of tables in the DML Statement
gbl - The group by list, if any
fromList - The from list, if any
Returns:
The generated ProjectRestrictNode atop the original FromTable.
Throws:
StandardException - Thrown on error

projectResultColumns

void projectResultColumns()
                    throws 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:
projectResultColumns in class ResultSetNode
Throws:
StandardException

setReferencedColumns

void setReferencedColumns()
Set the referenced columns in the column list if it may not be correct.


optimize

public ResultSetNode optimize(DataDictionary dataDictionary,
                              PredicateList predicateList,
                              double outerRows)
                       throws StandardException
Optimize a TableOperatorNode.

Overrides:
optimize in class ResultSetNode
Parameters:
dataDictionary - The DataDictionary to use for optimization
predicateList - The PredicateList to apply.
outerRows - The number of outer joining rows
Returns:
ResultSetNode The top of the optimized query tree
Throws:
StandardException - Thrown on error

modifyAccessPaths

public ResultSetNode modifyAccessPaths()
                                throws 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:
modifyAccessPaths in class ResultSetNode
Returns:
The modified query tree
Throws:
StandardException - Thrown on error
See Also:
ResultSetNode.modifyAccessPaths()

referencesTarget

public boolean referencesTarget(java.lang.String name,
                                boolean baseTable)
                         throws StandardException
Search to see if a query references the specifed table name.

Overrides:
referencesTarget in class ResultSetNode
Parameters:
name - Table name (String) to search for.
baseTable - Whether or not name is for a base table
Returns:
true if found, else false
Throws:
StandardException - Thrown on error

referencesSessionSchema

public boolean referencesSessionSchema()
                                throws StandardException
Return true if the node references SESSION schema tables (temporary or permanent)

Overrides:
referencesSessionSchema in class QueryTreeNode
Returns:
true if references SESSION schema tables, else false
Throws:
StandardException - Thrown on error

optimizeSource

protected ResultSetNode optimizeSource(Optimizer optimizer,
                                       ResultSetNode sourceResultSet,
                                       PredicateList predList,
                                       CostEstimate outerCost)
                                throws StandardException
Optimize a source result set to this table operator.

Throws:
StandardException - Thrown on error

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:
decrementLevel in class FromTable
Parameters:
decrement - The amount to decrement by.

adjustForSortElimination

void adjustForSortElimination()
Description copied from class: ResultSetNode
Notify the underlying result set tree that the optimizer has chosen to "eliminate" a sort. Sort elimination can happen as part of preprocessing (see esp. SelectNode.preprocess(...)) or it can happen if the optimizer chooses an access path that inherently returns the rows in the correct order (also known as a "sort avoidance" plan). In either case we drop the sort and rely on the underlying result set tree to return its rows in the correct order. For most types of ResultSetNodes we automatically get the rows in the correct order if the sort was eliminated. One exception to this rule, though, is the case of an IndexRowToBaseRowNode, for which we have to disable bulk fetching on the underlying base table. Otherwise the index scan could return rows out of order if the base table is updated while the scan is "in progress" (i.e. while the result set is open). In order to account for this (and potentially other, similar issues in the future) this method exists to notify the result set node that it is expected to return rows in the correct order. The result set can then take necessary action to satsify this requirement--such as disabling bulk fetch in the case of IndexRowToBaseRowNode. All of that said, any ResultSetNodes for which we could potentially eliminate sorts should override this method accordingly. So we don't ever expect to get here.

Overrides:
adjustForSortElimination in class ResultSetNode
See Also:
ResultSetNode.adjustForSortElimination()

adjustForSortElimination

void adjustForSortElimination(RequiredRowOrdering rowOrdering)
                        throws StandardException
Description copied from class: ResultSetNode
Same goal as adjustForSortElimination above, but this version takes a RequiredRowOrdering to allow nodes to adjust based on the ORDER BY clause, if needed.

Overrides:
adjustForSortElimination in class ResultSetNode
Throws:
StandardException
See Also:
ResultSetNode.adjustForSortElimination()

acceptChildren

void acceptChildren(Visitor v)
              throws StandardException
Accept the visitor for all visitable children of this node.

Overrides:
acceptChildren in class ResultSetNode
Parameters:
v - the visitor
Throws:
StandardException - on error

needsSpecialRCLBinding

public boolean needsSpecialRCLBinding()
apparently something special needs to be done for me....

Overrides:
needsSpecialRCLBinding in class FromTable

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.