java.lang.Iterable<OrderByColumn>, RequiredRowOrdering, Visitableclass OrderByList extends OrderedColumnList<OrderByColumn> implements RequiredRowOrdering
| Modifier and Type | Field | Description |
|---|---|---|
private boolean |
allAscending |
|
private boolean |
alwaysSort |
|
private ColumnOrdering[] |
columnOrdering |
|
private int |
estimatedRowSize |
|
private boolean |
isTableValueCtorOrdering |
true if this instance orders a
<table value constructor>. |
private java.lang.Object[] |
resultRow |
|
private int |
resultSetNumber |
|
private ResultSetNode |
resultToSort |
|
private SortCostController |
scc |
|
private boolean |
sortNeeded |
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEXeltClassELIMINATE_DUPS, NOTHING_REQUIRED, SORT_REQUIRED| Constructor | Description |
|---|---|
OrderByList(ResultSetNode rs,
ContextManager cm) |
Constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
(package private) void |
addOrderByColumn(OrderByColumn column) |
Add a column to the list
|
(package private) boolean |
allAscending() |
Are all columns in the list ascending.
|
(package private) void |
bindOrderByColumns(ResultSetNode target) |
Bind the update columns by their names to the target resultset of the
cursor specification.
|
(package private) void |
closeGap(int gap) |
Adjust addedColumnOffset values due to removal of a duplicate column
This routine is called by bind processing when it identifies and
removes a column from the result column list which was pulled up due
to its presence in the ORDER BY clause, but which was later found to
be a duplicate.
|
void |
estimateCost(double estimatedInputRows,
RowOrdering rowOrdering,
CostEstimate resultCost) |
Estimate the cost of doing a sort for this row ordering, given
the number of rows to be sorted.
|
(package private) void |
generate(ActivationClassBuilder acb,
MethodBuilder mb,
ResultSetNode child) |
generate the sort result set operating over the source
expression.
|
(package private) OrderByColumn |
getOrderByColumn(int position) |
Get a column from the list
|
int |
getResultSetNumber() |
|
boolean |
getSortNeeded() |
Get whether or not a sort is needed.
|
(package private) boolean |
isInOrderPrefix(ResultColumnList sourceRCL) |
Is this order by list an in order prefix of the specified RCL.
|
boolean |
isTableValueCtorOrdering() |
|
(package private) void |
pullUpOrderByColumns(ResultSetNode target) |
Pull up Order By columns by their names to the target resultset
of the cursor specification.
|
(package private) void |
remapColumnReferencesToExpressions() |
Remap all ColumnReferences in this tree to be clones of the
underlying expression.
|
(package private) void |
removeConstantColumns(PredicateList whereClause) |
Remove any constant columns from this order by list.
|
(package private) void |
removeDupColumns() |
Remove any duplicate columns from this order by list.
|
(package private) ResultColumnList |
reorderRCL(ResultColumnList resultColumns) |
Build a new RCL with the same RCs as the passed in RCL
but in an order that matches the ordering columns.
|
(package private) boolean |
requiresDescending(ColumnReference cRef,
int numOptimizables) |
Determine whether or not this RequiredRowOrdering has a
DESCENDING requirement for the column referenced by the
received ColumnReference.
|
(package private) void |
resetToSourceRCs() |
Order by columns now point to the PRN above the node of interest.
|
void |
sortNeeded() |
Indicate that a sort is necessary to fulfill this required ordering.
|
void |
sortNotNeeded() |
Indicate that a sort is *NOT* necessary to fulfill this required
ordering.
|
int |
sortRequired(RowOrdering rowOrdering,
OptimizableList optimizableList,
int[] proposedJoinOrder) |
Tell whether sorting is required for this RequiredRowOrdering,
given a RowOrdering.
|
int |
sortRequired(RowOrdering rowOrdering,
JBitSet tableMap,
OptimizableList optimizableList,
int[] proposedJoinOrder) |
Tell whether sorting is required for this RequiredRowOrdering,
given a RowOrdering representing a partial join order, and
a bit map telling what tables are represented in the join order.
|
java.lang.String |
toString() |
Format this node as a string
Each sub-class of QueryTreeNode should implement its own toString()
method.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetColumnOrderingaccept, 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, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExistacceptChildren, addElement, destructiveAppend, elementAt, indexOf, insertElementAt, iterator, nondestructiveAppend, printSubNodes, removeAllElements, removeElement, removeElementAt, setElementAt, sizeprivate boolean allAscending
private boolean alwaysSort
private ResultSetNode resultToSort
private SortCostController scc
private java.lang.Object[] resultRow
private ColumnOrdering[] columnOrdering
private int estimatedRowSize
private boolean sortNeeded
private int resultSetNumber
private boolean isTableValueCtorOrdering
true if this instance orders a
<table value constructor>.
See isTableValueCtorOrdering.OrderByList(ResultSetNode rs, ContextManager cm)
OrderByList is
attached to, e.g. SELECT, VALUES or a set operation.rs - The result set this OrderByList is ordering. May be
nullcm - The context managervoid addOrderByColumn(OrderByColumn column)
column - The column to add to the listboolean allAscending()
OrderByColumn getOrderByColumn(int position)
position - The column to get from the listvoid bindOrderByColumns(ResultSetNode target) throws StandardException
target - The underlying result setStandardException - Thrown on errorvoid closeGap(int gap)
gap - column which has been removed from the result column listvoid pullUpOrderByColumns(ResultSetNode target) throws StandardException
target - The underlying result setStandardExceptionboolean isInOrderPrefix(ResultColumnList sourceRCL)
sourceRCL - The source RCL.void resetToSourceRCs()
ResultColumnList reorderRCL(ResultColumnList resultColumns) throws StandardException
resultColumns - The RCL to reorder.StandardException - Thrown on errorvoid removeConstantColumns(PredicateList whereClause)
void removeDupColumns()
void generate(ActivationClassBuilder acb, MethodBuilder mb, ResultSetNode child) throws StandardException
acb - the tool for building the classmb - the method the generated code is to go intoStandardException - thrown on failurepublic int sortRequired(RowOrdering rowOrdering, OptimizableList optimizableList, int[] proposedJoinOrder) throws StandardException
RequiredRowOrderingsortRequired in interface RequiredRowOrderingrowOrdering - The order of rows in questionoptimizableList - The list of join participantsproposedJoinOrder - The current join order being considered by
the optimizer. We need to look into this to determine if the outer
optimizables are single row result set if the order by column is
on an inner optimizable and that inner optimizable is not a one.
proposedJoinOrder is a map onto optimizableList:
it contains indexes of optimizables in that list in the join order
proposed, cf. OptimizerImpl#proposedJoinOrder.StandardException - Thrown on errorRequiredRowOrdering.sortRequired(RowOrdering, OptimizableList, int[])public int sortRequired(RowOrdering rowOrdering, JBitSet tableMap, OptimizableList optimizableList, int[] proposedJoinOrder) throws StandardException
RequiredRowOrderingsortRequired in interface RequiredRowOrderingrowOrdering - The order of rows in the partial join ordertableMap - A bit map of the tables in the partial join orderoptimizableList - The list of join participantsproposedJoinOrder - The current join order being considered by
the optimizer. We need to look into this to determine if the outer
optimizables are single row result set if the order by column is
on an inner optimizable and that inner optimizable is not a one.
proposedJoinOrder is a map onto optimizableList:
it contains indexes of optimizables in that list in the join order
proposed, cf. OptimizerImpl#proposedJoinOrder.
DERBY-3926 and DERBY-6148StandardException - Thrown on errorRequiredRowOrdering.sortRequired(RowOrdering, JBitSet, OptimizableList, int[])public void estimateCost(double estimatedInputRows,
RowOrdering rowOrdering,
CostEstimate resultCost)
throws StandardException
RequiredRowOrderingestimateCost in interface RequiredRowOrderingestimatedInputRows - The estimated number of rows to sortrowOrdering - The ordering of the input rowsresultCost - A place to store the resulting costStandardException - Thrown on errorRequiredRowOrdering.estimateCost(double, org.apache.derby.iapi.sql.compile.RowOrdering, org.apache.derby.iapi.sql.compile.CostEstimate)public void sortNeeded()
RequiredRowOrderingsortNeeded in interface RequiredRowOrderingRequiredRowOrdering.sortNeeded()public void sortNotNeeded()
RequiredRowOrderingsortNotNeeded in interface RequiredRowOrderingRequiredRowOrdering.sortNotNeeded()void remapColumnReferencesToExpressions()
throws StandardException
StandardException - Thrown on errorpublic boolean getSortNeeded()
getSortNeeded in interface RequiredRowOrderingboolean requiresDescending(ColumnReference cRef, int numOptimizables) throws StandardException
StandardExceptionpublic java.lang.String toString()
QueryTreeNodetoString in class QueryTreeNodepublic int getResultSetNumber()
public boolean isTableValueCtorOrdering()
true if the ORDER BY is attached to a
<table value constructor>, i.e. a VALUES clause.Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.