Optimizable
, Visitable
DistinctNode
, GroupByNode
, HashTableNode
, MaterializeResultSetNode
, NormalizeResultSetNode
, OrderByNode
, ProjectRestrictNode
, RowCountNode
, ScrollInsensitiveResultSetNode
, WindowResultSetNode
abstract class SingleChildResultSetNode extends FromTable
ResultSetNode.QueryExpressionClauses
Modifier and Type | Field | Description |
---|---|---|
(package private) ResultSetNode |
childResult |
ResultSetNode under the SingleChildResultSetNode
|
protected boolean |
hasTrulyTheBestAccessPath |
ADD_PLAN, bestAccessPath, bestCostEstimate, bestSortAvoidancePath, correlationName, corrTableName, currentAccessPath, hashKeyColumns, initialCapacity, level, LOAD_PLAN, loadFactor, maxCapacity, origTableName, REMOVE_PLAN, tableNumber, tableProperties, trulyTheBestAccessPath, userSpecifiedJoinStrategy
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
Constructor | Description |
---|---|
SingleChildResultSetNode(ResultSetNode childResult,
java.util.Properties tableProperties,
ContextManager cm) |
Modifier and Type | Method | Description |
---|---|---|
(package private) void |
acceptChildren(Visitor v) |
Accept the visitor for all visitable children of this node.
|
(package private) ResultSetNode |
addNewPredicate(Predicate predicate) |
Add a new predicate to the list.
|
(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) ResultSetNode |
changeAccessPath() |
The optimizer's decision on the access path for a result set
may require the generation of extra result sets.
|
(package private) void |
decrementLevel(int decrement) |
Decrement (query block) level (0-based) for this FromTable.
|
(package private) ResultSetNode |
ensurePredicateList(int numTables) |
Ensure that the top of the RSN tree has a PredicateList.
|
(package private) boolean |
flattenableInFromSubquery(FromList fromList) |
Evaluate whether or not the subquery in a FromSubquery is flattenable.
|
boolean |
forUpdate() |
Return true if this is the target table of an update
|
(package private) ResultSetNode |
getChildResult() |
Return the childResult from this node.
|
(package private) CostEstimate |
getFinalCostEstimate() |
Get the final CostEstimate for this node.
|
(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.
|
AccessPath |
getTrulyTheBestAccessPath() |
Get the best access path overall for this Optimizable.
|
void |
initAccessPaths(Optimizer optimizer) |
Init the access paths for this optimizable.
|
(package private) boolean |
isNotExists() |
Return whether or not the underlying ResultSet tree is for a NOT EXISTS join.
|
(package private) boolean |
isOneRowResultSet() |
Return whether or not the underlying ResultSet tree will return
a single row, at most.
|
(package private) boolean |
isOrderedOn(ColumnReference[] crs,
boolean permuteOrdering,
java.util.List<FromBaseTable> fbtHolder) |
Return whether or not the underlying ResultSet tree
is ordered on the specified columns.
|
(package private) ResultSetNode |
modifyAccessPaths() |
Modify the access paths according to the decisions the optimizer
made.
|
(package private) ResultSetNode |
optimize(DataDictionary dataDictionary,
PredicateList predicates,
double outerRows) |
Optimize this SingleChildResultSetNode.
|
(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.
|
void |
pullOptPredicates(OptimizablePredicateList optimizablePredicates) |
Pull all the OptimizablePredicates from this Optimizable and put them
in the given OptimizablePredicateList.
|
(package private) void |
pushExpressions(PredicateList predicateList) |
Push expressions down to the first ResultSetNode which can do expression
evaluation and has the same referenced table map.
|
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.
|
protected boolean |
reflectionNeededForProjection() |
Determine whether we need to do reflection in order to do the projection.
|
(package private) void |
setChildResult(ResultSetNode childResult) |
Set the childResult for this node.
|
(package private) void |
setLevel(int level) |
Set the (query block) level (0-based) for this FromTable.
|
(package private) boolean |
subqueryReferencesTarget(java.lang.String name,
boolean baseTable) |
Return whether or not this ResultSetNode contains a subquery with a
reference to the specified target.
|
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.
|
(package private) int |
updateTargetLockMode() |
Get the lock mode for the target of an update statement
(a delete or update).
|
assignCostEstimate, canBeOrdered, columnsAreUpdatable, considerSortAvoidancePath, convertAbsoluteToRelativeColumnPosition, cursorTargetTable, estimateCost, feasibleJoinStrategy, fillInReferencedTableMap, flatten, getBaseTableName, getBestAccessPath, getBestSortAvoidancePath, getCorrelationName, getCostEstimate, getCurrentAccessPath, getExposedName, getLevel, getMergeTableID, getName, getNumColumnsReturned, getOrigTableName, getProperties, getResultColumnsForList, getSchemaDescriptor, getSchemaDescriptor, getScratchCostEstimate, getTableDescriptor, getTableName, getTableNumber, getUserSpecifiedJoinStrategy, hashKeyColumns, hasLargeObjectColumns, hasTableNumber, initialCapacity, isBaseTable, isCoveringIndex, isFlattenableJoinNode, isJoinColumnForRightOuterJoin, isMaterializable, isOneRowScan, isTargetTable, legalJoinOrder, loadFactor, LOJ_reorderable, markUpdatableByCursor, maxCapacity, memoryUsageOK, modifyAccessPath, needsSpecialRCLBinding, nextAccessPath, optimizeIt, optimizeSubqueries, pushOptPredicate, rememberAsBest, rememberJoinStrategyAsBest, rememberSortAvoidancePath, resetJoinStrategies, setCostEstimateCost, setHashKeyColumns, setMergeTableID, setOrigTableName, setProperties, setTableNumber, startOptimizing, supportsMultipleInstantiations, tellRowOrderingAboutConstantColumns, toString, transformOuterJoins, uniqueJoin, verifyProperties
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDataDictionary, getOptimizerTracer, getReferencedTableMap, getResultSetNumber, optimizerTracingIsOn
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
assignResultSetNumber, bindExpressions, bindExpressionsWithTables, bindNonVTITables, bindResultColumns, bindResultColumns, bindTargetExpressions, bindUntypedNullsToResultColumns, bindVTITables, columnTypesAndLengthsMatch, considerMaterialization, enhanceRCLForInsert, generateNormalizationResultSet, generateResultSet, genProjectRestrict, genProjectRestrict, genProjectRestrictForReordering, getAllResultColumns, getCandidateFinalCostEstimate, getCostEstimate, getCursorTargetTable, getFromList, getMatchingColumn, getNewCostEstimate, getOptimizer, getOptimizerImpl, getRCLForInsert, getReferencedTableMap, getResultColumns, getResultSetNumber, getScratchCostEstimate, isCursorTargetTable, isInsertSource, isPossibleDistinctScan, isStatementResultSet, isUpdatableCursor, LOJgetReferencedTables, makeResultDescription, makeResultDescriptors, markAsCursorTargetTable, markForDistinctScan, markStatementResultSet, modifyAccessPaths, notCursorTargetTable, notFlattenableJoin, numDistinctAggregates, parseDefault, performMaterialization, printQueryExpressionSuffixClauses, projectResultColumns, pushOffsetFetchFirst, pushOrderByList, pushQueryExpressionSuffix, rejectParameters, rejectXMLValues, renameGeneratedResultNames, replaceOrForbidDefaults, returnsAtMostOneRow, setCandidateFinalCostEstimate, setCostEstimate, setCursorTargetTable, setInsertSource, setOptimizer, setReferencedTableMap, setResultColumns, setResultSetNumber, setResultToBooleanTrueNode, setScratchCostEstimate, setTableConstructorTypes, verifySelectStarSubquery
accept, addTag, taggedWith
ResultSetNode childResult
protected boolean hasTrulyTheBestAccessPath
SingleChildResultSetNode(ResultSetNode childResult, java.util.Properties tableProperties, ContextManager cm)
public AccessPath getTrulyTheBestAccessPath()
Optimizable
getTrulyTheBestAccessPath
in interface Optimizable
getTrulyTheBestAccessPath
in class FromTable
Optimizable.getTrulyTheBestAccessPath()
ResultSetNode getChildResult()
void setChildResult(ResultSetNode childResult)
childResult
- The new childResult for this node.public void pullOptPredicates(OptimizablePredicateList optimizablePredicates) throws StandardException
Optimizable
pullOptPredicates
in interface Optimizable
pullOptPredicates
in class FromTable
optimizablePredicates
- The list to put the pulled predicates
in.StandardException
- Thrown on errorOptimizable.pullOptPredicates(org.apache.derby.iapi.sql.compile.OptimizablePredicateList)
public boolean forUpdate()
Optimizable
forUpdate
in interface Optimizable
forUpdate
in class FromTable
Optimizable.forUpdate()
public void initAccessPaths(Optimizer optimizer)
Optimizable
initAccessPaths
in interface Optimizable
initAccessPaths
in class FromTable
optimizer
- The optimizer being used.Optimizable.initAccessPaths(org.apache.derby.iapi.sql.compile.Optimizer)
public void updateBestPlanMap(short action, java.lang.Object planKey) throws StandardException
Optimizable
updateBestPlanMap
in interface Optimizable
updateBestPlanMap
in class FromTable
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.StandardException
Makes a call to add/load/remove a plan mapping for this node,
and then makes the necessary call to recurse on this node's
child, in order to ensure that we've handled the full plan
all the way down this node's subtree.
void printSubNodes(int depth)
printSubNodes
in class ResultSetNode
depth
- The depth of this node in the treeboolean referencesTarget(java.lang.String name, boolean baseTable) throws StandardException
referencesTarget
in class ResultSetNode
name
- Table name (String) to search for.baseTable
- Whether or not name is for a base tableStandardException
- Thrown on errorpublic boolean referencesSessionSchema() throws StandardException
referencesSessionSchema
in class QueryTreeNode
StandardException
- Thrown on errorvoid setLevel(int level)
boolean subqueryReferencesTarget(java.lang.String name, boolean baseTable) throws StandardException
subqueryReferencesTarget
in class ResultSetNode
name
- The table name.baseTable
- Whether or not the name is for a base table.StandardException
- Thrown on errorResultSetNode preprocess(int numTables, GroupByList gbl, FromList fromList) throws StandardException
preprocess
in class ResultSetNode
numTables
- Number of tables in the DML Statementgbl
- The group by list, if anyfromList
- The from list, if anyStandardException
- Thrown on errorResultSetNode addNewPredicate(Predicate predicate) throws StandardException
addNewPredicate
in class ResultSetNode
predicate
- The predicate to addStandardException
- Thrown on errorvoid pushExpressions(PredicateList predicateList) throws StandardException
pushExpressions
in class FromTable
predicateList
- The PredicateList.StandardException
- Thrown on errorboolean flattenableInFromSubquery(FromList fromList)
flattenableInFromSubquery
in class ResultSetNode
fromList
- The outer from listResultSetNode ensurePredicateList(int numTables) throws StandardException
ensurePredicateList
in class ResultSetNode
numTables
- The number of tables in the query.StandardException
- Thrown on errorResultSetNode optimize(DataDictionary dataDictionary, PredicateList predicates, double outerRows) throws StandardException
optimize
in class ResultSetNode
dataDictionary
- The DataDictionary to use for optimizationpredicates
- The PredicateList to optimize. This should
be a join predicate.outerRows
- The number of outer joining rowsStandardException
- Thrown on errorResultSetNode modifyAccessPaths() throws StandardException
ResultSetNode
modifyAccessPaths
in class ResultSetNode
StandardException
- Thrown on errorResultSetNode.modifyAccessPaths()
ResultSetNode changeAccessPath() throws StandardException
ResultSetNode
changeAccessPath
in class ResultSetNode
StandardException
- Thrown on errorResultSetNode.changeAccessPath()
FromTable getFromTableByName(java.lang.String name, java.lang.String schemaName, boolean exactMatch) throws StandardException
getFromTableByName
in class FromTable
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.StandardException
- Thrown on errorvoid decrementLevel(int decrement)
decrementLevel
in class FromTable
decrement
- The amount to decrement by.int updateTargetLockMode()
updateTargetLockMode
in class ResultSetNode
TransactionController
boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, java.util.List<FromBaseTable> fbtHolder) throws StandardException
isOrderedOn
in class ResultSetNode
crs
- The specified ColumnReference[]permuteOrdering
- Whether or not the order of the CRs in the array can be permutedfbtHolder
- List that is to be filled with the FromBaseTableStandardException
- Thrown on errorboolean isOneRowResultSet() throws StandardException
isOneRowResultSet
in class ResultSetNode
StandardException
- Thrown on errorboolean isNotExists()
isNotExists
in class ResultSetNode
protected boolean reflectionNeededForProjection()
void adjustForSortElimination()
ResultSetNode
adjustForSortElimination
in class ResultSetNode
ResultSetNode.adjustForSortElimination()
void adjustForSortElimination(RequiredRowOrdering rowOrdering) throws StandardException
ResultSetNode
adjustForSortElimination
in class ResultSetNode
StandardException
ResultSetNode.adjustForSortElimination()
CostEstimate getFinalCostEstimate() throws StandardException
getFinalCostEstimate
in class FromTable
StandardException
void acceptChildren(Visitor v) throws StandardException
acceptChildren
in class FromTable
v
- the visitorStandardException
- on errorApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.