class RowResultSetNode extends FromTable
ResultSetNode.QueryExpressionClauses
Modifier and Type | Field and Description |
---|---|
private java.util.List<AggregateNode> |
aggregates |
(package private) ResultSetNode.QueryExpressionClauses |
qec |
(package private) SubqueryList |
subquerys |
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 and Description |
---|
RowResultSetNode(ResultColumnList valuesClause,
java.util.Properties tableProperties,
ContextManager cm)
Constructor for a RowResultSetNode.
|
Modifier and Type | Method and Description |
---|---|
(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 |
bindExpressions(FromList fromListParam)
Bind the expressions in this RowResultSetNode.
|
(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 ResultSetNode.
|
(package private) void |
bindTargetExpressions(FromList fromListParam)
Bind the expressions in the target list.
|
(package private) void |
bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
Bind any untyped null nodes to the types in the given ResultColumnList.
|
private boolean |
canWeCacheResults() |
(package private) ResultSetNode |
enhanceRCLForInsert(InsertNode target,
boolean inOrder,
int[] colMap)
Modify the RCL of this node to match the target of the insert.
|
(package private) ResultSetNode |
ensurePredicateList(int numTables)
Ensure that the top of the RSN tree has a PredicateList.
|
CostEstimate |
estimateCost(OptimizablePredicateList predList,
ConglomerateDescriptor cd,
CostEstimate outerCost,
Optimizer optimizer,
RowOrdering rowOrdering)
Estimate the cost of scanning this Optimizable using the given
predicate list with the given conglomerate.
|
(package private) boolean |
flattenableInFromSubquery(FromList fromList)
Evaluate whether or not the subquery in a FromSubquery is flattenable.
|
(package private) void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
The generated ResultSet will be:
RowResultSet -- for the VALUES clause
|
(package private) java.lang.String |
getExposedName()
Get the exposed name for this table, which is the name that can
be used to refer to it in the rest of the query.
|
(package private) ResultColumn |
getMatchingColumn(ColumnReference columnReference)
Try to find a ResultColumn in the table represented by this FromTable
that matches the name in the given ColumnReference.
|
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) ResultSetNode |
optimize(DataDictionary dataDictionary,
PredicateList predicateList,
double outerRows)
Optimize this SelectNode.
|
(package private) void |
optimizeSubqueries(DataDictionary dd,
double rowCount)
Optimize any subqueries that haven't been optimized any where
else.
|
(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 |
pushOffsetFetchFirst(ValueNode offset,
ValueNode fetchFirst,
boolean hasJDBClimitClause)
Push down the offset and fetch first parameters, if any, to this node.
|
(package private) void |
pushOrderByList(OrderByList orderByList)
Push the order by list down from the cursor node
into its child result set so that the optimizer
has all of the information that it needs to
consider sort avoidance.
|
void |
pushQueryExpressionSuffix()
Set up a new level for order by and fetch/offset clauses.
|
boolean |
referencesSessionSchema()
Return true if the node references SESSION schema tables (temporary or permanent)
|
(package private) void |
replaceOrForbidDefaults(TableDescriptor ttd,
ResultColumnList tcl,
boolean allowDefaults)
Replace any DEFAULTs with the associated tree for the default if
allowed, or flag (when inside top level set operator nodes).
|
(package private) boolean |
returnsAtMostOneRow()
Return whether or not this ResultSet tree is guaranteed to return
at most 1 row based on heuristics.
|
(package private) void |
setTableConstructorTypes(ResultColumnList typeColumns)
Set the type of each parameter in the result column list for this table constructor.
|
(package private) java.lang.String |
statementToString() |
(package private) void |
verifySelectStarSubquery(FromList outerFromList,
int subqueryType)
Verify that a SELECT * is valid for this type of subquery.
|
acceptChildren, assignCostEstimate, canBeOrdered, columnsAreUpdatable, considerSortAvoidancePath, convertAbsoluteToRelativeColumnPosition, cursorTargetTable, decrementLevel, feasibleJoinStrategy, fillInReferencedTableMap, flatten, forUpdate, getBaseTableName, getBestAccessPath, getBestSortAvoidancePath, getCorrelationName, getCostEstimate, getCurrentAccessPath, getFinalCostEstimate, getFromTableByName, 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, needsSpecialRCLBinding, nextAccessPath, optimizeIt, pullOptPredicates, pushExpressions, pushOptPredicate, rememberAsBest, rememberJoinStrategyAsBest, rememberSortAvoidancePath, resetJoinStrategies, setCostEstimateCost, setHashKeyColumns, setLevel, setMergeTableID, setOrigTableName, setProperties, setTableNumber, startOptimizing, supportsMultipleInstantiations, tellRowOrderingAboutConstantColumns, toString, transformOuterJoins, uniqueJoin, updateBestPlanMap, verifyProperties
adjustForSortElimination, assignResultSetNumber, bindResultColumns, bindResultColumns, bindVTITables, changeAccessPath, columnTypesAndLengthsMatch, considerMaterialization, generateNormalizationResultSet, generateResultSet, genProjectRestrict, genProjectRestrict, genProjectRestrictForReordering, getAllResultColumns, getCandidateFinalCostEstimate, getCostEstimate, getCursorTargetTable, getFromList, 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, projectResultColumns, referencesTarget, rejectParameters, rejectXMLValues, renameGeneratedResultNames, setCandidateFinalCostEstimate, setCostEstimate, setCursorTargetTable, setInsertSource, setOptimizer, setReferencedTableMap, setResultColumns, setResultSetNumber, setResultToBooleanTrueNode, setScratchCostEstimate, subqueryReferencesTarget, updateTargetLockMode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDataDictionary, getOptimizerTracer, getReferencedTableMap, getResultSetNumber, optimizerTracingIsOn
accept, addTag, taggedWith
SubqueryList subquerys
private java.util.List<AggregateNode> aggregates
RowResultSetNode(ResultColumnList valuesClause, java.util.Properties tableProperties, ContextManager cm)
valuesClause
- The result column list for the VALUES clause.tableProperties
- Properties list associated with the tablecm
- The context managerjava.lang.String statementToString()
void printSubNodes(int depth)
printSubNodes
in class ResultSetNode
depth
- The depth of this node in the treepublic boolean referencesSessionSchema() throws StandardException
QueryTreeNode
referencesSessionSchema
in class QueryTreeNode
StandardException
- Thrown on errorResultSetNode enhanceRCLForInsert(InsertNode target, boolean inOrder, int[] colMap) throws StandardException
enhanceRCLForInsert
in class ResultSetNode
target
- the target node for the insertinOrder
- are source cols in same order as target cols?colMap
- int array representation of correspondence between
RCLs - colmap[i] = -1 -> missing in current RCL
colmap[i] = j -> targetRCL(i) <-> thisRCL(j+1)StandardException
- Thrown on errorpublic CostEstimate estimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException
Optimizable
estimateCost
in interface Optimizable
estimateCost
in class FromTable
predList
- The predicate list to optimize againstcd
- The conglomerate descriptor to get the cost ofouterCost
- The estimated cost of the part of the plan outer
to this optimizable.optimizer
- The optimizer to use to help estimate the costrowOrdering
- The row ordering for all the tables in the
join order, including this one.StandardException
- Thrown on errorOptimizable.estimateCost(org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor, org.apache.derby.iapi.sql.compile.CostEstimate, org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.RowOrdering)
ResultSetNode bindNonVTITables(DataDictionary dataDictionary, FromList fromListParam) throws StandardException
bindNonVTITables
in class ResultSetNode
dataDictionary
- The DataDictionary to use for bindingfromListParam
- FromList to use/append to.StandardException
- Thrown on errorvoid bindExpressions(FromList fromListParam) throws StandardException
bindExpressions
in class ResultSetNode
fromListParam
- FromList to use/append to.StandardException
- Thrown on errorvoid bindExpressionsWithTables(FromList fromListParam) throws StandardException
bindExpressionsWithTables
in class ResultSetNode
fromListParam
- FromList to use/append to.StandardException
- Thrown on errorvoid bindTargetExpressions(FromList fromListParam) throws StandardException
bindTargetExpressions
in class ResultSetNode
StandardException
- Thrown on errorvoid bindUntypedNullsToResultColumns(ResultColumnList bindingRCL) throws StandardException
bindUntypedNullsToResultColumns
in class ResultSetNode
bindingRCL
- The ResultColumnList with the types to bind to.StandardException
- Thrown on errorResultColumn getMatchingColumn(ColumnReference columnReference) throws StandardException
getMatchingColumn
in class ResultSetNode
columnReference
- The columnReference whose name we're looking
for in the given table.StandardException
- Thrown on errorjava.lang.String getExposedName() throws StandardException
getExposedName
in class FromTable
StandardException
- Thrown on errorvoid verifySelectStarSubquery(FromList outerFromList, int subqueryType) throws StandardException
verifySelectStarSubquery
in class ResultSetNode
outerFromList
- The FromList from the outer query block(s)subqueryType
- The subquery typeStandardException
- Thrown on errorpublic void pushQueryExpressionSuffix()
ResultSetNode
ResultSetNode.QueryExpressionClauses
.
Overridden by implementors of pushOrderByNode, pushOffsetFetchFirst.pushQueryExpressionSuffix
in class ResultSetNode
void pushOrderByList(OrderByList orderByList)
pushOrderByList
in class ResultSetNode
orderByList
- The order by listvoid pushOffsetFetchFirst(ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause)
pushOffsetFetchFirst
in class ResultSetNode
offset
- the OFFSET, if anyfetchFirst
- the OFFSET FIRST, if anyhasJDBClimitClause
- true if the clauses were added by (and have the semantics of) a JDBC limit clauseResultSetNode 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 ensurePredicateList(int numTables) throws StandardException
ensurePredicateList
in class ResultSetNode
numTables
- The number of tables in the query.StandardException
- Thrown on errorResultSetNode addNewPredicate(Predicate predicate) throws StandardException
addNewPredicate
in class ResultSetNode
predicate
- The predicate to addStandardException
- Thrown on errorboolean flattenableInFromSubquery(FromList fromList)
flattenableInFromSubquery
in class ResultSetNode
fromList
- The outer from listResultSetNode optimize(DataDictionary dataDictionary, PredicateList predicateList, double outerRows) throws StandardException
optimize
in class ResultSetNode
dataDictionary
- The DataDictionary to use for optimizationpredicateList
- The predicate list to optimize againstouterRows
- The number of outer joining rowsStandardException
- Thrown on errorpublic Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
Optimizable
modifyAccessPath
in interface Optimizable
modifyAccessPath
in class FromTable
outerTables
- Bit map of the tables that are outer to this one
in the join order.StandardException
- Thrown on errorOptimizable.modifyAccessPath(org.apache.derby.iapi.util.JBitSet)
ResultSetNode modifyAccessPaths() throws StandardException
ResultSetNode
modifyAccessPaths
in class ResultSetNode
StandardException
- Thrown on errorResultSetNode.modifyAccessPaths()
boolean returnsAtMostOneRow()
returnsAtMostOneRow
in class ResultSetNode
void setTableConstructorTypes(ResultColumnList typeColumns) throws StandardException
setTableConstructorTypes
in class ResultSetNode
typeColumns
- The ResultColumnList containing the desired result
types.StandardException
- Thrown on errorvoid generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
generate
in class QueryTreeNode
acb
- The ActivationClassBuilder for the class being builtmb
- The method for the generated code to go intoStandardException
- Thrown on errorvoid replaceOrForbidDefaults(TableDescriptor ttd, ResultColumnList tcl, boolean allowDefaults) throws StandardException
replaceOrForbidDefaults
in class ResultSetNode
ttd
- The TableDescriptor for the target table.tcl
- The RCL for the target table.allowDefaults
- true if allowedStandardException
- Thrown on errorvoid optimizeSubqueries(DataDictionary dd, double rowCount) throws StandardException
optimizeSubqueries
in class FromTable
StandardException
- Thrown on errorvoid adjustForSortElimination()
ResultSetNode
adjustForSortElimination
in class ResultSetNode
ResultSetNode.adjustForSortElimination()
private boolean canWeCacheResults() throws StandardException
StandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.