Class SortToIndexRule


  • @API(EXPERIMENTAL)
    public class SortToIndexRule
    extends PlannerRule<LogicalSortExpression>
    A rule for implementing a LogicalSortExpression as a scan of any appropriately-ordered index. The rule's logic mirrors FilterWithElementWithComparisonRule, but applied to sorts rather than filters.
     
           +-----------------------------+                 +---------------------------+
           |                             |                 |                           |
           |  LogicalSortExpression      |                 |  LogicalSortExpression    |
           |            prefix, suffix   |                 |                  suffix   |
           |                             |                 |                           |
           +-------------+---------------+                 +-------------+-------------+
                         |                     +------>                  |
                         | qun                                           | newQun
                         |                                               |
         +---------------+------------------+            +---------------+------------------+
         |                                  |            |                                  |
         |  FullUnorderedScanExpression     |            |  IndexEntrySourceScanExpression  |
         |                                  |            |                     order|prefix |
         +----------------------------------+            |                                  |
                                                         +----------------------------------+
     
     
    or if there is no suffix:
     
           +-----------------------------+               +----------------------------------+
           |                             |               |                                  |
           |    LogicalSortExpression    |     +------>  |  IndexEntrySourceScanExpression  |
           |                     prefix  |               |                           orders |
           |                             |               |                                  |
           +-------------+---------------+               +----------------------------------+
                         |
                         | qun
                         |
         +---------------+------------------+
         |                                  |
         |  FullUnorderedScanExpression     |
         |                                  |
         +----------------------------------+