Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.sql.compile
Interface RowOrdering  view RowOrdering download RowOrdering.java


public interface RowOrdering

This interface provides a representation of the ordering of rows in a ResultSet.


Field Summary
static int ASCENDING
           
static int DESCENDING
           
static int DONTCARE
           
 
Method Summary
 void addOrderedColumn(int direction, int tableNumber, int columnNumber)
          Add a column to this RowOrdering in the current order position.
 void addUnorderedOptimizable(Optimizable optimizable)
          Add an unordered optimizable to this RowOrdering.
 boolean alwaysOrdered(int tableNumber)
          Ask whether the given table is always ordered.
 void columnAlwaysOrdered(Optimizable optimizable, int columnNumber)
          Tell this RowOrdering that it is always ordered on the given column of the given optimizable.
 void copy(RowOrdering copyTo)
          Copy the contents of this RowOrdering to the given RowOrdering.
 void nextOrderPosition(int direction)
          Move to the next order position for adding ordered columns.
 void optimizableAlwaysOrdered(Optimizable optimizable)
          Tell this RowOrdering that it is always ordered on the given optimizable This is useful when considering a unique index where there is an equality match on the entire key - in this case, all the columns are ordered, regardless of the direction or position, or even whether the columns are in the index.
 boolean orderedOnColumn(int direction, int tableNumber, int columnNumber)
          Tell whether this ordering is ordered on the given column.
 boolean orderedOnColumn(int direction, int orderPosition, int tableNumber, int columnNumber)
          Tell whether this ordering is ordered on the given column in the given position
 void removeOptimizable(int tableNumber)
          Tell this row ordering that it is no longer ordered on the given table.
 

Field Detail

ASCENDING

public static final int ASCENDING
See Also:
Constant Field Values

DESCENDING

public static final int DESCENDING
See Also:
Constant Field Values

DONTCARE

public static final int DONTCARE
See Also:
Constant Field Values
Method Detail

orderedOnColumn

public boolean orderedOnColumn(int direction,
                               int orderPosition,
                               int tableNumber,
                               int columnNumber)
                        throws org.apache.derby.iapi.error.StandardException
Tell whether this ordering is ordered on the given column in the given position


orderedOnColumn

public boolean orderedOnColumn(int direction,
                               int tableNumber,
                               int columnNumber)
                        throws org.apache.derby.iapi.error.StandardException
Tell whether this ordering is ordered on the given column. This is similar to the method above, but it checks whether the column is ordered in any position, rather than a specified position. This is useful for operations like DISTINCT and GROUP BY.


addOrderedColumn

public void addOrderedColumn(int direction,
                             int tableNumber,
                             int columnNumber)
Add a column to this RowOrdering in the current order position. This is a no-op if there are any unordered optimizables in the join order (see below).


nextOrderPosition

public void nextOrderPosition(int direction)
Move to the next order position for adding ordered columns. This is a no-op if there are any unordered optimizables in the join order (see below).


optimizableAlwaysOrdered

public void optimizableAlwaysOrdered(Optimizable optimizable)
Tell this RowOrdering that it is always ordered on the given optimizable This is useful when considering a unique index where there is an equality match on the entire key - in this case, all the columns are ordered, regardless of the direction or position, or even whether the columns are in the index.


columnAlwaysOrdered

public void columnAlwaysOrdered(Optimizable optimizable,
                                int columnNumber)
Tell this RowOrdering that it is always ordered on the given column of the given optimizable. This is useful when a column in the optimizable has an equals comparison with a constant expression. This is reset when the optimizable is removed from this RowOrdering.


alwaysOrdered

public boolean alwaysOrdered(int tableNumber)
Ask whether the given table is always ordered.


removeOptimizable

public void removeOptimizable(int tableNumber)
Tell this row ordering that it is no longer ordered on the given table. Also, adjust the current order position, if necessary. This only works to remove ordered columns from the end of the ordering.


addUnorderedOptimizable

public void addUnorderedOptimizable(Optimizable optimizable)
Add an unordered optimizable to this RowOrdering. This is to solve the following problem: Suppose we have the query: select * from r, s, t order by r.a, t.b Also suppose there are indexes on r.a and t.b. When the optimizer considers the join order (r, s, t) using the index on r.a, the heap on s, and the index on t.b, the rows from the join order will *NOT* be ordered on t.b, because there is an unordered result set between r and t. So, when s is added to the partial join order, and we then add table t to the join order, we want to ensure that we don't add column t.b to the RowOrdering.


copy

public void copy(RowOrdering copyTo)
Copy the contents of this RowOrdering to the given RowOrdering.