ISortHandler Class Reference

Defines the interface for passing down a relational SORT operation to the DSII. More...

List of all members.

Public Member Functions

virtual simba_uint16 Passdown (AESort *in_node, SESortOrder &io_sortOrder)=0
 Pass down the given SORT operation.
virtual SharedPtr
< DSIExtResultSet
TakeResult ()=0
 Get the result set representing the result of applying the sort operation.
virtual ~ISortHandler ()
 Destructor.

Protected Member Functions

 ISortHandler ()
 Constructor.

Detailed Description

Defines the interface for passing down a relational SORT operation to the DSII.

A relational SORT operation orders the result set of a query by the specified column list, and optionally limit the rows returned to a specified range. When ORDER BY is used in conjunction with the TOP clause, the result set is limited to the first N number of ordered rows; otherwise, it returns all ordered rows.

Simba SQLEngine attempts to pass down the SORT operation by passing in the AESort node and a reference to the type of pass-down sort order (see SESortOrder). The initial value of sort order type is ORDER_UNDEFINED and it should be set by the DSII according to the order type which it is able to sort. If pass-down sort succeeds, then the engine will call TakeResult() and get the table that represents the result applying SORT operation.

SQLEngine is able to handle SORT operation with and without TOP operation. See the following examples:

When the ORDER BY is accompanied with the TOP, the engine separates the SORT and TOP operations. It would attempt to pass down SORT first, and if that succeeds, it would pass down TOP on the result of the first pass-down. This allows the DSII to have the special implementation for passdown TOP N SORT, as sorting with a limit could be much cheaper than a full sorting.

For example, during the first pass-down, the DSII can choose to sort the given table right away, or delay the sort operation. If the sort is delayed, later on during the second pass-down, the DSII can sort with a limit number. This avoids sorting all rows and returning the first n rows, which is unnecessary and expensive for large tables.

Passdown sort includes the entire passdown and partial pass down.

For example in the following query:

The DSII is able to sort on C1 but not on C2. In this case, the DSII can do a partial sort by only sorting on C1 and the engine will do the rest.

SQLEngine supports entire sort passdown and doesn't support partial sort passdown yet.


Constructor & Destructor Documentation

virtual ~ISortHandler (  )  [inline, virtual]

Destructor.

ISortHandler (  )  [inline, protected]

Constructor.


Member Function Documentation

virtual simba_uint16 Passdown ( AESort in_node,
SESortOrder io_sortOrder 
) [pure virtual]

Pass down the given SORT operation.

Parameters:
in_node The SORT operation node. Cannot be NULL. (NOT OWN)
io_sortOrder The type of the passdown sort order. It is supposed to be set by the DSII according to the order type it is able to sort.
Returns:
The number of prefix columns the DSII is able to sort if the operation is passed down successfully; 0 otherwise.
virtual SharedPtr<DSIExtResultSet> TakeResult (  )  [pure virtual]

Get the result set representing the result of applying the sort operation.

Returns:
The result set representing the result of applying the sort operation if it is passed down successfully, NULL otherwise.

The documentation for this class was generated from the following file:

Generated on Wed May 17 14:21:18 2017 for SimbaEngine 10.1.3.1011 by simba