Class WindowResultSetNode
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.SingleChildResultSetNode
org.apache.derby.impl.sql.compile.WindowResultSetNode
- All Implemented Interfaces:
Optimizable, Visitable
A WindowResultSetNode represents a result set for a window partitioning on a
select. Modeled on the code in GroupByNode.
-
Nested Class Summary
Nested classes/interfaces inherited from class ResultSetNode
ResultSetNode.QueryExpressionClauses -
Field Summary
FieldsModifier and TypeFieldDescription(package private) FromTableThe parent to the WindowResultSetNode.(package private) WindowDefinitionNode(package private) List<WindowFunctionNode> Fields inherited from class SingleChildResultSetNode
childResult, hasTrulyTheBestAccessPathFields inherited from class FromTable
ADD_PLAN, bestAccessPath, bestCostEstimate, bestSortAvoidancePath, correlationName, corrTableName, currentAccessPath, hashKeyColumns, initialCapacity, level, LOAD_PLAN, loadFactor, maxCapacity, origTableName, REMOVE_PLAN, tableNumber, tableProperties, trulyTheBestAccessPath, userSpecifiedJoinStrategyFields inherited from class QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX -
Constructor Summary
ConstructorsConstructorDescriptionWindowResultSetNode(ResultSetNode bottomPR, WindowDefinitionNode windowDef, List<WindowFunctionNode> windowFuncCalls, int nestingLevel, ContextManager cm) Constructor for a WindowResultSetNode. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidSubstitute new result columns for window function calls and add the result columns to childResult's list of columns.private voidAdd a new PR node.private booleancolRefAlreadySeen(List<ValueNode> uniqueColRefs, ColumnReference cand) (package private) voidgenerate(ActivationClassBuilder acb, MethodBuilder mb) Do the code generation for this node.(package private) final FromTablevoidprintSubNodes(int depth) QueryTreeNode overrideMethods inherited from class SingleChildResultSetNode
acceptChildren, addNewPredicate, adjustForSortElimination, adjustForSortElimination, changeAccessPath, decrementLevel, ensurePredicateList, flattenableInFromSubquery, forUpdate, getChildResult, getFinalCostEstimate, getFromTableByName, getTrulyTheBestAccessPath, initAccessPaths, isNotExists, isOneRowResultSet, isOrderedOn, modifyAccessPaths, optimize, preprocess, pullOptPredicates, pushExpressions, referencesSessionSchema, referencesTarget, reflectionNeededForProjection, setChildResult, setLevel, subqueryReferencesTarget, updateBestPlanMap, updateTargetLockModeMethods inherited from class FromTable
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, verifyPropertiesMethods inherited from class ResultSetNode
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, verifySelectStarSubqueryMethods inherited from class QueryTreeNode
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, verifyClassExistMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Optimizable
getDataDictionary, getOptimizerTracer, getReferencedTableMap, getResultSetNumber, optimizerTracingIsOnMethods inherited from interface Visitable
accept, addTag, taggedWith
-
Field Details
-
parent
FromTable parentThe parent to the WindowResultSetNode. We generate a ProjectRestrict over the windowing node and parent is set to that node. -
windowFuncCalls
List<WindowFunctionNode> windowFuncCalls -
wdn
-
-
Constructor Details
-
WindowResultSetNode
WindowResultSetNode(ResultSetNode bottomPR, WindowDefinitionNode windowDef, List<WindowFunctionNode> windowFuncCalls, int nestingLevel, ContextManager cm) throws StandardException Constructor for a WindowResultSetNode.- Parameters:
bottomPR- The project restrict result set we want to wrapwindowDef- The window definitionwindowFuncCalls- All window function calls in SELECT's select list and order by list.nestingLevel- Nesting levelcm- The context manager- Throws:
StandardException- Thrown on error
-
-
Method Details
-
addNewPRNode
Add a new PR node. Put the new PR under any sort.- Throws:
StandardException- standard error policy
-
colRefAlreadySeen
private boolean colRefAlreadySeen(List<ValueNode> uniqueColRefs, ColumnReference cand) throws StandardException - Parameters:
uniqueColRefs- list of unique column referencescand- the candidate to check is present in list- Returns:
trueif an equivalent column reference tocandis already present inuniqueColRefs- Throws:
StandardException- standard error policy
-
addNewColumns
Substitute new result columns for window function calls and add the result columns to childResult's list of columns.- Throws:
StandardException- standard error policy
-
generate
Description copied from class:QueryTreeNodeDo the code generation for this node. This is a place-holder method - it should be over-ridden in the sub-classes.- Overrides:
generatein classQueryTreeNode- Parameters:
acb- The ActivationClassBuilder for the class being builtmb- The method for the generated code to go into- Throws:
StandardException- Thrown on error
-
getParent
- Returns:
- parent of this node, a PRN, used by SelectNode to retrieve new top result set node after window result set rewrite of result set tree.
-
printSubNodes
public void printSubNodes(int depth) QueryTreeNode override- Overrides:
printSubNodesin classSingleChildResultSetNode- Parameters:
depth- The depth of this node in the tree- See Also:
-