| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private boolean | |
| private ColumnOrdering[] | |
| private int | |
| private boolean | isTableValueCtorOrdering
|
| private Object[] | |
| private int | |
| private ResultSetNode | |
| private SortCostController | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv | OrderByList(ResultSetNode
The result set this rs, ContextManager OrderByList is ordering. May be
nullThe context manager cm)Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv boolean | Returns: Whether or not all columns in the list ascending.Are all columns in the list ascending. |
| pack-priv void | bindOrderByColumns(ResultSetNode
The underlying result set target)Bind the update columns by their names to the target resultset of the cursor specification. |
| pack-priv void | closeGap(int
column which has been removed from the result column list 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. |
| public void | estimateCost(double
The estimated number of rows to sort estimatedInputRows, RowOrdering The ordering of the input rows rowOrdering, CostEstimate A place to store the resulting cost resultCost)Implements org. Estimate the cost of doing a sort for this row ordering, given the number of rows to be sorted. |
| pack-priv void | generate(ActivationClassBuilder
the tool for building the class acb, MethodBuilder the method the generated code is to go into mb, ResultSetNode child)generate the sort result set operating over the source expression. |
| pack-priv OrderByColumn | |
| public int | |
| public boolean | Returns: Whether or not a sort is needed.Implements org. Get whether or not a sort is needed. |
| pack-priv boolean | Returns: Whether or not this order by list an in order prefix of the specified RCL.The source RCL. sourceRCL)Is this order by list an in order prefix of the specified RCL. |
| public boolean | Returns: true if the ORDER BY is attached to a
<table value constructor>, i.e. a VALUES clause.
|
| pack-priv void | pullUpOrderByColumns(ResultSetNode
The underlying result set target)Pull up Order By columns by their names to the target resultset of the cursor specification. |
| pack-priv void | remapColumnReferencesToExpressions()
Remap all ColumnReferences in this tree to be clones of the underlying expression. |
| pack-priv void | removeConstantColumns(PredicateList whereClause)
Remove any constant columns from this order by list. |
| pack-priv void | |
| pack-priv ResultColumnList | reorderRCL(ResultColumnList
The RCL to reorder. resultColumns)Build a new RCL with the same RCs as the passed in RCL but in an order that matches the ordering columns. |
| pack-priv boolean | requiresDescending(ColumnReference cRef, int numOptimizables)
Determine whether or not this RequiredRowOrdering has a DESCENDING requirement for the column referenced by the received ColumnReference. |
| pack-priv void | |
| public void | sortNeeded()
Implements org. Indicate that a sort is necessary to fulfill this required ordering. |
| public void | sortNotNeeded()
Implements org. Indicate that a sort is *NOT* necessary to fulfill this required ordering. |
| public int | sortRequired(RowOrdering
The order of rows in question rowOrdering, OptimizableList The list of join participants optimizableList, int[] 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)proposedJoinOrder is a map onto optimizableList:
it contains indexes of optimizables in that list in the join order
proposed, cf. OptimizerImpl#proposedJoinOrder.Implements org. Tell whether sorting is required for this RequiredRowOrdering, given a RowOrdering. |
| public int | sortRequired(RowOrdering
The order of rows in the partial join order rowOrdering, JBitSet A bit map of the tables in the partial join order tableMap, OptimizableList The list of join participants optimizableList, int[] 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)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-6148Implements org. 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. |
| public String | toString()
Overrides org. Format this node as a string Each sub-class of QueryTreeNode should implement its own toString() method. |
| allAscending | back to summary |
|---|---|
| private boolean allAscending | |
| alwaysSort | back to summary |
|---|---|
| private boolean alwaysSort | |
| columnOrdering | back to summary |
|---|---|
| private ColumnOrdering[] columnOrdering | |
| estimatedRowSize | back to summary |
|---|---|
| private int estimatedRowSize | |
| isTableValueCtorOrdering | back to summary |
|---|---|
| private boolean isTableValueCtorOrdering
| |
| resultRow | back to summary |
|---|---|
| private Object[] resultRow | |
| resultSetNumber | back to summary |
|---|---|
| private int resultSetNumber | |
| resultToSort | back to summary |
|---|---|
| private ResultSetNode resultToSort | |
| scc | back to summary |
|---|---|
| private SortCostController scc | |
| sortNeeded | back to summary |
|---|---|
| private boolean sortNeeded | |
| OrderByList | back to summary |
|---|---|
| pack-priv OrderByList(ResultSetNode rs, ContextManager cm) Constructor.
Initialize with the type of the result set this
| |
| addOrderByColumn | back to summary |
|---|---|
| pack-priv void addOrderByColumn(OrderByColumn column) Add a column to the list
| |
| allAscending | back to summary |
|---|---|
| pack-priv boolean allAscending() Are all columns in the list ascending.
| |
| bindOrderByColumns | back to summary |
|---|---|
| pack-priv void bindOrderByColumns(ResultSetNode target) throws StandardException Bind the update columns by their names to the target resultset of the cursor specification.
| |
| closeGap | back to summary |
|---|---|
| pack-priv 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. The OrderByColumn instance for the removed column has been adjusted to point to the true column in the result column list and its addedColumnOffset has been reset to -1. This routine finds any other OrderByColumn instances which had an offset greater than that of the column that has been deleted, and decrements their addedColumOffset to account for the deleted column's removal.
| |
| estimateCost | back to summary |
|---|---|
| public void estimateCost(double estimatedInputRows, RowOrdering rowOrdering, CostEstimate resultCost) throws StandardException Implements org. Doc from org. Estimate the cost of doing a sort for this row ordering, given the number of rows to be sorted. This does not take into account whether the sort is really needed. It also estimates the number of result rows.
| |
| generate | back to summary |
|---|---|
| pack-priv void generate(ActivationClassBuilder acb, MethodBuilder mb, ResultSetNode child) throws StandardException generate the sort result set operating over the source expression.
| |
| getOrderByColumn | back to summary |
|---|---|
| pack-priv OrderByColumn getOrderByColumn(int position) Get a column from the list
| |
| getResultSetNumber | back to summary |
|---|---|
| public int getResultSetNumber() | |
| getSortNeeded | back to summary |
|---|---|
| public boolean getSortNeeded() Implements org. Get whether or not a sort is needed.
| |
| isInOrderPrefix | back to summary |
|---|---|
| pack-priv boolean isInOrderPrefix(ResultColumnList sourceRCL) Is this order by list an in order prefix of the specified RCL. This is useful when deciding if an order by list can be eliminated due to a sort from an underlying distinct or union.
| |
| isTableValueCtorOrdering | back to summary |
|---|---|
public boolean isTableValueCtorOrdering()
| |
| pullUpOrderByColumns | back to summary |
|---|---|
| pack-priv void pullUpOrderByColumns(ResultSetNode target) throws StandardException Pull up Order By columns by their names to the target resultset of the cursor specification.
| |
| remapColumnReferencesToExpressions | back to summary |
|---|---|
| pack-priv void remapColumnReferencesToExpressions() throws StandardException Remap all ColumnReferences in this tree to be clones of the underlying expression.
| |
| removeConstantColumns | back to summary |
|---|---|
| pack-priv void removeConstantColumns(PredicateList whereClause) Remove any constant columns from this order by list. Constant columns are ones where all of the column references are equal to constant expressions according to the given predicate list. | |
| removeDupColumns | back to summary |
|---|---|
| pack-priv void removeDupColumns() Remove any duplicate columns from this order by list. For example, one may "ORDER BY 1, 1, 2" can be reduced to "ORDER BY 1, 2". Beetle 5401. | |
| reorderRCL | back to summary |
|---|---|
| pack-priv ResultColumnList reorderRCL(ResultColumnList resultColumns) throws StandardException Build a new RCL with the same RCs as the passed in RCL but in an order that matches the ordering columns.
| |
| requiresDescending | back to summary |
|---|---|
| pack-priv boolean requiresDescending(ColumnReference cRef, int numOptimizables) throws StandardException Determine whether or not this RequiredRowOrdering has a DESCENDING requirement for the column referenced by the received ColumnReference. | |
| resetToSourceRCs | back to summary |
|---|---|
| pack-priv void resetToSourceRCs() Order by columns now point to the PRN above the node of interest. We need them to point to the RCL under that one. This is useful when combining sorts where we need to reorder the sorting columns. | |
| sortNeeded | back to summary |
|---|---|
| public void sortNeeded() Implements org. Doc from org. Indicate that a sort is necessary to fulfill this required ordering. This method may be called many times during a single optimization.
| |
| sortNotNeeded | back to summary |
|---|---|
| public void sortNotNeeded() Implements org. Doc from org. Indicate that a sort is *NOT* necessary to fulfill this required ordering. This method may be called many times during a single optimization.
| |
| sortRequired | back to summary |
|---|---|
| public int sortRequired(RowOrdering rowOrdering, OptimizableList optimizableList, int[] proposedJoinOrder) throws StandardException Implements org. Doc from org. Tell whether sorting is required for this RequiredRowOrdering, given a RowOrdering.
| |
| sortRequired | back to summary |
|---|---|
| public int sortRequired(RowOrdering rowOrdering, JBitSet tableMap, OptimizableList optimizableList, int[] proposedJoinOrder) throws StandardException Implements org. Doc from org. 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. This is useful for reducing the number of cases the optimizer has to consider.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Doc from org. Format this node as a string Each sub-class of QueryTreeNode should implement its own toString() method. In each case, toString() should format the class members that are not sub-types of QueryTreeNode (printSubNodes() takes care of following the references to sub-nodes, and toString() takes care of all members that are not sub-nodes). Newlines should be used liberally - one good way to do this is to have a newline at the end of each formatted member. It's also a good idea to put the name of each member in front of the formatted value. For example, the code might look like: "memberName: " + memberName + "\n" + ... Vector members containing subclasses of QueryTreeNode should subclass QueryTreeNodeVector. Such subclasses form a special case: These classes should not implement printSubNodes, since there is generic handling in QueryTreeNodeVector. They should only implement toString if they contain additional members. | |