Defines the interface for passing down a relational SORT operation to the DSII. More...
Public Member Functions
|virtual simba_uint16||Passdown (AESort *in_node, SESortOrder &io_sortOrder)=0|
|Pass down the given SORT operation. |
< DSIExtResultSet >
|Get the result set representing the result of applying the sort operation. |
Protected Member Functions
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.
Pass down the given SORT operation.
|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.|
Get the result set representing the result of applying the sort operation.