|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.QueryTreeNodeVector
org.apache.derby.impl.sql.compile.OrderedColumnList
org.apache.derby.impl.sql.compile.OrderByList
public class OrderByList
An OrderByList is an ordered list of columns in the ORDER BY clause. That is, the order of columns in this list is significant - the first column in the list is the most significant in the ordering, and the last column in the list is the least significant.
Field Summary | |
---|---|
private boolean |
allAscending
|
private boolean |
alwaysSort
|
private ColumnOrdering[] |
columnOrdering
|
private int |
estimatedRowSize
|
private java.lang.Object[] |
resultRow
|
private int |
resultSetNumber
|
private ResultSetNode |
resultToSort
|
private SortCostController |
scc
|
private boolean |
sortNeeded
|
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
---|
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired |
Fields inherited from interface org.apache.derby.iapi.sql.compile.RequiredRowOrdering |
---|
ELIMINATE_DUPS, NOTHING_REQUIRED, SORT_REQUIRED |
Constructor Summary | |
---|---|
OrderByList()
|
Method Summary | |
---|---|
void |
addOrderByColumn(OrderByColumn column)
Add a column to the list |
(package private) boolean |
allAscending()
Are all columns in the list ascending. |
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. |
void |
generate(ActivationClassBuilder acb,
MethodBuilder mb,
ResultSetNode child)
generate the sort result set operating over the source expression. |
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. |
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,
JBitSet tableMap,
OptimizableList optimizableList)
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. |
int |
sortRequired(RowOrdering rowOrdering,
OptimizableList optimizableList)
Tell whether sorting is required for this RequiredRowOrdering, given a RowOrdering. |
java.lang.String |
toString()
Format this node as a string Each sub-class of QueryTreeNode should implement its own toString() method. |
Methods inherited from class org.apache.derby.impl.sql.compile.OrderedColumnList |
---|
getColumnOrdering |
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNodeVector |
---|
acceptChildren, addElement, destructiveAppend, elementAt, indexOf, insertElementAt, nondestructiveAppend, printSubNodes, remove, removeAllElements, removeElement, removeElementAt, setElementAt, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private 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
Constructor Detail |
---|
public OrderByList()
Method Detail |
---|
public void addOrderByColumn(OrderByColumn column)
column
- The column to add to the listboolean allAscending()
public OrderByColumn getOrderByColumn(int position)
position
- The column to get from the listpublic void bindOrderByColumns(ResultSetNode target) throws StandardException
target
- The underlying result set
StandardException
- Thrown on errorvoid closeGap(int gap)
gap
- column which has been removed from the result column listpublic void pullUpOrderByColumns(ResultSetNode target) throws StandardException
target
- The underlying result set
StandardException
boolean 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()
public 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 into
StandardException
- thrown on failurepublic int sortRequired(RowOrdering rowOrdering, OptimizableList optimizableList) throws StandardException
RequiredRowOrdering
sortRequired
in interface RequiredRowOrdering
rowOrdering
- The order of rows in questionoptimizableList
- The current join order being considered by
the optimizer. We need to look into this to determine if the outer
optimizables are single row resultset if the order by column is
on an inner optimizable and that inner optimizable is not a one
row resultset. DERBY-3926
StandardException
- Thrown on errorRequiredRowOrdering.sortRequired(org.apache.derby.iapi.sql.compile.RowOrdering, org.apache.derby.iapi.sql.compile.OptimizableList)
public int sortRequired(RowOrdering rowOrdering, JBitSet tableMap, OptimizableList optimizableList) throws StandardException
RequiredRowOrdering
sortRequired
in interface RequiredRowOrdering
rowOrdering
- The order of rows in the partial join ordertableMap
- A bit map of the tables in the partial join orderoptimizableList
- The current join order being considered by
the optimizer. We need to look into this to determine if the outer
optimizables are single row resultset if the order by column is
on an inner optimizable and that inner optimizable is not a one
row resultset. DERBY-3926
StandardException
- Thrown on errorRequiredRowOrdering.sortRequired(org.apache.derby.iapi.sql.compile.RowOrdering, org.apache.derby.iapi.sql.compile.OptimizableList)
public void estimateCost(double estimatedInputRows, RowOrdering rowOrdering, CostEstimate resultCost) throws StandardException
RequiredRowOrdering
estimateCost
in interface RequiredRowOrdering
estimatedInputRows
- The estimated number of rows to sortrowOrdering
- The ordering of the input rowsresultCost
- A place to store the resulting cost
StandardException
- Thrown on errorRequiredRowOrdering.estimateCost(double, org.apache.derby.iapi.sql.compile.RowOrdering, org.apache.derby.iapi.sql.compile.CostEstimate)
public void sortNeeded()
RequiredRowOrdering
sortNeeded
in interface RequiredRowOrdering
RequiredRowOrdering.sortNeeded()
public void sortNotNeeded()
RequiredRowOrdering
sortNotNeeded
in interface RequiredRowOrdering
RequiredRowOrdering.sortNotNeeded()
void remapColumnReferencesToExpressions() throws StandardException
StandardException
- Thrown on errorpublic boolean getSortNeeded()
getSortNeeded
in interface RequiredRowOrdering
boolean requiresDescending(ColumnReference cRef, int numOptimizables) throws StandardException
StandardException
public java.lang.String toString()
QueryTreeNode
toString
in class QueryTreeNode
public int getResultSetNumber()
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |