|
|||||||||
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.OrderedColumn
org.apache.derby.impl.sql.compile.OrderByColumn
public class OrderByColumn
An OrderByColumn is a column in the ORDER BY clause. An OrderByColumn can be ordered ascending or descending. We need to make sure that the named columns are columns in that query, and that positions are within range.
Field Summary | |
---|---|
private int |
addedColumnOffset
If this sort key is added to the result column list then it is at result column position 1 + resultColumnList.size() - resultColumnList.getOrderBySelect() + addedColumnOffset If the sort key is already in the result column list then addedColumnOffset < 0. |
private boolean |
ascending
|
private ValueNode |
expression
|
private OrderByList |
list
|
private boolean |
nullsOrderedLow
|
private ResultColumn |
resultCol
|
Fields inherited from class org.apache.derby.impl.sql.compile.OrderedColumn |
---|
columnPosition, UNMATCHEDPOSITION |
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 |
Constructor Summary | |
---|---|
OrderByColumn()
|
Method Summary | |
---|---|
(package private) void |
acceptChildren(Visitor v)
Accept the visitor for all visitable children of this node. |
void |
bindOrderByColumn(ResultSetNode target,
OrderByList oblist)
Bind this column. |
(package private) void |
clearAddedColumnOffset()
Reset addedColumnOffset to indicate that column is no longer added An added column is one which was artificially added to the result column list due to its presence in the ORDER BY clause, as opposed to having been explicitly selected by the user. |
(package private) void |
collapseAddedColumnGap(int gap)
Adjust addedColumnOffset to reflect that a column has been removed This routine is called when a previously-added result column has been removed due to being detected as a duplicate. |
(package private) boolean |
constantColumn(PredicateList whereClause)
Is this OrderByColumn constant, according to the given predicate list? |
(package private) ValueNode |
getNonRedundantExpression()
Get the underlying expression, skipping over ResultColumns that are marked redundant. |
(package private) ResultColumn |
getResultColumn()
Get the underlying ResultColumn. |
void |
init(java.lang.Object expression)
Initializer. |
boolean |
isAscending()
Get the column order. |
boolean |
isNullsOrderedLow()
Get the column NULL ordering. |
private static boolean |
isReferedColByNum(ValueNode expression)
|
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
void |
pullUpOrderByColumn(ResultSetNode target)
Pull up this orderby column if it doesn't appear in the resultset |
(package private) void |
remapColumnReferencesToExpressions()
Remap all the column references under this OrderByColumn to their expressions. |
(package private) void |
resetToSourceRC()
Order by columns now point to the PRN above the node of interest. |
private void |
resolveAddedColumn(ResultSetNode target)
Assuming this OrderByColumn was "pulled" into the received target's ResultColumnList (because it wasn't there to begin with), use this.addedColumnOffset to figure out which of the target's result columns is the one corresponding to "this". |
private ResultColumn |
resolveColumnReference(ResultSetNode target,
ColumnReference cr)
|
void |
setDescending()
Mark the column as descending order |
void |
setNullsOrderedLow()
Mark the column as ordered NULL values lower than non-NULL values. |
java.lang.String |
toString()
Convert this object to a String. |
Methods inherited from class org.apache.derby.impl.sql.compile.OrderedColumn |
---|
getColumnPosition, setColumnPosition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private ResultColumn resultCol
private boolean ascending
private boolean nullsOrderedLow
private ValueNode expression
private OrderByList list
private int addedColumnOffset
Constructor Detail |
---|
public OrderByColumn()
Method Detail |
---|
public void init(java.lang.Object expression)
init
in class QueryTreeNode
expression
- Expression of this columnpublic java.lang.String toString()
toString
in class OrderedColumn
public void printSubNodes(int depth)
printSubNodes
in class QueryTreeNode
depth
- The depth of this node in the treepublic void setDescending()
public boolean isAscending()
isAscending
in class OrderedColumn
public void setNullsOrderedLow()
public boolean isNullsOrderedLow()
isNullsOrderedLow
in class OrderedColumn
ResultColumn getResultColumn()
ValueNode getNonRedundantExpression()
public void bindOrderByColumn(ResultSetNode target, OrderByList oblist) throws StandardException
target
- The result set being selected fromoblist
- OrderByList which contains this column
StandardException
- Thrown on error
StandardException
- Thrown when column not foundprivate void resolveAddedColumn(ResultSetNode target)
public void pullUpOrderByColumn(ResultSetNode target) throws StandardException
target
- The result set being selected from
StandardException
void resetToSourceRC()
boolean constantColumn(PredicateList whereClause)
void remapColumnReferencesToExpressions() throws StandardException
StandardException
- Thrown on errorprivate static boolean isReferedColByNum(ValueNode expression) throws StandardException
StandardException
private ResultColumn resolveColumnReference(ResultSetNode target, ColumnReference cr) throws StandardException
StandardException
void clearAddedColumnOffset()
void collapseAddedColumnGap(int gap)
gap
- offset of the column which has just been removed from listvoid acceptChildren(Visitor v) throws StandardException
acceptChildren
in class QueryTreeNode
v
- the visitor
StandardException
- on error
|
Built on Thu 2012-03-29 21:53:33+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |