Class TableOperatorNode
- java.lang.Object
-
- org.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:
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".
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.derby.impl.sql.compile.ResultSetNode
ResultSetNode.QueryExpressionClauses
-
-
Field Summary
Fields Modifier and Type Field Description 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.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
-
-
Constructor Summary
Constructors Constructor Description TableOperatorNode(ResultSetNode leftResultSet, ResultSetNode rightResultSet, java.util.Properties tableProperties, ContextManager cm)
Constructor for a TableOperatorNode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (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.(package private) void
bindExpressions(FromList fromListParam)
Bind the expressions under this TableOperatorNode.(package private) void
bindExpressionsWithTables(FromList fromListParam)
Bind the expressions in this ResultSetNode if it has tables.(package private) ResultSetNode
bindNonVTITables(DataDictionary dataDictionary, FromList fromListParam)
Bind the non VTI tables in this TableOperatorNode.(package private) void
bindResultColumns(TableDescriptor targetTableDescriptor, FromVTI targetVTI, ResultColumnList targetColumnList, DMLStatementNode statement, FromList fromListParam)
Bind the result columns for this ResultSetNode to a base table.(package private) void
bindResultColumns(FromList fromListParam)
Bind the result columns of this ResultSetNode when there is no base table to bind them to.(package private) void
bindUntypedNullsToResultColumns(ResultColumnList rcl)
DERBY-4365 Bind untyped nulls to the types in the given ResultColumnList.(package private) 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.(package private) 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.(package private) 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.(package private) ResultSetNode
getLeftmostResultSet()
(package private) ResultSetNode
getLeftResultSet()
Get the leftResultSet from this node.(package private) ResultSetNode
getRightResultSet()
Get the rightResultSet from this node.Optimizable
modifyAccessPath(JBitSet outerTables)
Modify the access path for this Optimizable, as necessary.(package private) ResultSetNode
modifyAccessPaths()
Modify the access paths according to the decisions the optimizer made.(package private) boolean
needsSpecialRCLBinding()
apparently something special needs to be done for me....(package private) 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.(package private) ResultSetNode
preprocess(int numTables, GroupByList gbl, FromList fromList)
Put a ProjectRestrictNode on top of each FromTable in the FromList.(package private) 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)(package private) boolean
referencesTarget(java.lang.String name, boolean baseTable)
Search to see if a query references the specifed table name.(package private) void
rejectParameters()
Check for (and reject) ?(package private) void
setLeftmostResultSet(ResultSetNode newLeftResultSet)
(package private) void
setLevel(int level)
Set the (query block) level (0-based) for this FromTable.(package private) 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, columnsAreUpdatable, considerSortAvoidancePath, convertAbsoluteToRelativeColumnPosition, cursorTargetTable, estimateCost, feasibleJoinStrategy, fillInReferencedTableMap, flatten, forUpdate, getBaseTableName, getBestAccessPath, getBestSortAvoidancePath, getCorrelationName, getCostEstimate, getCurrentAccessPath, getFinalCostEstimate, getLevel, getMergeTableID, getName, getNumColumnsReturned, getOrigTableName, getProperties, getResultColumnsForList, getSchemaDescriptor, getSchemaDescriptor, getScratchCostEstimate, getTableDescriptor, getTableName, getTableNumber, getTrulyTheBestAccessPath, getUserSpecifiedJoinStrategy, hashKeyColumns, hasLargeObjectColumns, hasTableNumber, initAccessPaths, initialCapacity, isBaseTable, isCoveringIndex, isFlattenableJoinNode, isJoinColumnForRightOuterJoin, isMaterializable, isOneRowScan, isTargetTable, legalJoinOrder, loadFactor, LOJ_reorderable, markUpdatableByCursor, maxCapacity, memoryUsageOK, nextAccessPath, optimizeIt, optimizeSubqueries, pullOptPredicates, pushExpressions, pushOptPredicate, rememberAsBest, rememberJoinStrategyAsBest, rememberSortAvoidancePath, resetJoinStrategies, setCostEstimateCost, setHashKeyColumns, setMergeTableID, 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, enhanceRCLForInsert, ensurePredicateList, flattenableInFromSubquery, generateNormalizationResultSet, generateResultSet, genProjectRestrict, genProjectRestrict, genProjectRestrictForReordering, getAllResultColumns, getCandidateFinalCostEstimate, getCostEstimate, getCursorTargetTable, getFromList, getMatchingColumn, getNewCostEstimate, getOptimizer, getOptimizerImpl, getRCLForInsert, getReferencedTableMap, getResultColumns, getResultSetNumber, getScratchCostEstimate, isCursorTargetTable, isInsertSource, isNotExists, isOneRowResultSet, isOrderedOn, isPossibleDistinctScan, isStatementResultSet, isUpdatableCursor, LOJgetReferencedTables, makeResultDescription, makeResultDescriptors, markAsCursorTargetTable, markForDistinctScan, markStatementResultSet, modifyAccessPaths, notCursorTargetTable, notFlattenableJoin, numDistinctAggregates, parseDefault, performMaterialization, printQueryExpressionSuffixClauses, pushOffsetFetchFirst, pushOrderByList, pushQueryExpressionSuffix, rejectXMLValues, renameGeneratedResultNames, replaceOrForbidDefaults, returnsAtMostOneRow, setCandidateFinalCostEstimate, setCostEstimate, setCursorTargetTable, setInsertSource, setOptimizer, setReferencedTableMap, setResultColumns, setResultSetNumber, setResultToBooleanTrueNode, setScratchCostEstimate, setTableConstructorTypes, subqueryReferencesTarget, updateTargetLockMode, verifySelectStarSubquery
-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isAtomic, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, 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, getOptimizerTracer, getReferencedTableMap, getResultSetNumber, optimizerTracingIsOn
-
Methods inherited from interface org.apache.derby.iapi.sql.compile.Visitable
accept, addTag, taggedWith
-
-
-
-
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(ResultSetNode leftResultSet, ResultSetNode rightResultSet, java.util.Properties tableProperties, ContextManager cm) throws StandardException
Constructor for a TableOperatorNode.- Parameters:
leftResultSet
- The ResultSetNode on the left side of this noderightResultSet
- The ResultSetNode on the right side of this nodetableProperties
- Properties list associated with the tablecm
- The context manager- Throws:
StandardException
- Thrown on error
-
-
Method Detail
-
bindUntypedNullsToResultColumns
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 classResultSetNode
- 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 interfaceOptimizable
- Overrides:
modifyAccessPath
in classFromTable
- 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 interfaceOptimizable
- Overrides:
verifyProperties
in classFromTable
- 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 interfaceOptimizable
- Overrides:
updateBestPlanMap
in classFromTable
- 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.
-
printSubNodes
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 classResultSetNode
- Parameters:
depth
- The depth of this node in the tree
-
getLeftResultSet
ResultSetNode getLeftResultSet()
Get the leftResultSet from this node.- Returns:
- ResultSetNode The leftResultSet from this node.
-
getRightResultSet
ResultSetNode getRightResultSet()
Get the rightResultSet from this node.- Returns:
- ResultSetNode The rightResultSet from this node.
-
getLeftmostResultSet
ResultSetNode getLeftmostResultSet()
-
setLeftmostResultSet
void setLeftmostResultSet(ResultSetNode newLeftResultSet)
-
setLevel
void setLevel(int level)
Set the (query block) level (0-based) for this FromTable.
-
getExposedName
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 classFromTable
- Returns:
- The exposed name for this table.
-
setNestedInParens
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
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 classResultSetNode
- Parameters:
dataDictionary
- The DataDictionary to use for bindingfromListParam
- FromList to use/append to.- Returns:
- ResultSetNode Returns this.
- Throws:
StandardException
- Thrown on error
-
bindVTITables
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 classResultSetNode
- Parameters:
fromListParam
- FromList to use/append to.- Returns:
- ResultSetNode Returns this.
- Throws:
StandardException
- Thrown on error
-
bindExpressions
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 classResultSetNode
- Parameters:
fromListParam
- FromList to use/append to.- Throws:
StandardException
- Thrown on error
-
rejectParameters
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 classResultSetNode
- Throws:
StandardException
- Thrown if a ? parameter found directly under a ResultColumn
-
bindExpressionsWithTables
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 classResultSetNode
- Parameters:
fromListParam
- FromList to use/append to.- Throws:
StandardException
- Thrown on error
-
bindResultColumns
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 classResultSetNode
- Parameters:
fromListParam
- FromList to use/append to.- Throws:
StandardException
- Thrown on error
-
bindResultColumns
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 classResultSetNode
- Parameters:
targetTableDescriptor
- 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.- Throws:
StandardException
- Thrown on error
-
getFromTableByName
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 classFromTable
- 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
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 classResultSetNode
- Parameters:
numTables
- Number of tables in the DML Statementgbl
- The group by list, if anyfromList
- 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 classResultSetNode
- Throws:
StandardException
-
setReferencedColumns
void setReferencedColumns()
Set the referenced columns in the column list if it may not be correct.
-
optimize
ResultSetNode optimize(DataDictionary dataDictionary, PredicateList predicateList, double outerRows) throws StandardException
Optimize a TableOperatorNode.- Overrides:
optimize
in classResultSetNode
- Parameters:
dataDictionary
- The DataDictionary to use for optimizationpredicateList
- 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
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 classResultSetNode
- Returns:
- The modified query tree
- Throws:
StandardException
- Thrown on error- See Also:
ResultSetNode.modifyAccessPaths()
-
referencesTarget
boolean referencesTarget(java.lang.String name, boolean baseTable) throws StandardException
Search to see if a query references the specifed table name.- Overrides:
referencesTarget
in classResultSetNode
- 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 classQueryTreeNode
- 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 classFromTable
- 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 classResultSetNode
- 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 classResultSetNode
- 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 classFromTable
- Parameters:
v
- the visitor- Throws:
StandardException
- on error
-
needsSpecialRCLBinding
boolean needsSpecialRCLBinding()
apparently something special needs to be done for me....- Overrides:
needsSpecialRCLBinding
in classFromTable
-
-