Class KuduSortRule

java.lang.Object
org.apache.calcite.plan.RelOptRule
com.twilio.kudu.sql.rules.KuduSortRule
Direct Known Subclasses:
KuduSortedAggregationRule, KuduSortRule.KuduSortWithFilter, KuduSortRule.KuduSortWithoutFilter

public abstract class KuduSortRule extends org.apache.calcite.plan.RelOptRule
Two Sort Rules that look to push the Sort into the Kudu RPC. Rule that pushes down the sort into kudu if we are sorting by columns that are a prefix of the primary key columns in the table. This rule eliminates sorting on the client.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Searches RexNode to see if the Kudu column index -- stored as KuduSortRule.KuduFilterVisitor.mustHave is present in the RexNode and is required.
    static class 
    Rule to match a Sort above Filter and it is above KuduQuery.
    static class 
    Rule to match a Sort above KuduQuery.

    Nested classes/interfaces inherited from class org.apache.calcite.plan.RelOptRule

    org.apache.calcite.plan.RelOptRule.ConverterRelOptRuleOperand
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.calcite.plan.RelOptRule
     
    protected List<Integer>
     
    static final org.apache.calcite.plan.RelOptRule
     

    Fields inherited from class org.apache.calcite.plan.RelOptRule

    description, operands, relBuilderFactory
  • Constructor Summary

    Constructors
    Constructor
    Description
    KuduSortRule(org.apache.calcite.plan.RelOptRuleOperand operand, org.apache.calcite.tools.RelBuilderFactory factory, String description)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canApply(org.apache.calcite.plan.RelTraitSet sortTraits, org.apache.calcite.rex.RexNode offset, KuduQuery query, org.apache.kudu.client.KuduTable openedTable, Optional<org.apache.calcite.rel.core.Filter> filter)
     
    void
    perform(org.apache.calcite.plan.RelOptRuleCall call, org.apache.calcite.rel.core.Sort originalSort, KuduQuery query, org.apache.kudu.client.KuduTable openedTable, Optional<org.apache.calcite.rel.core.Filter> filter)
     

    Methods inherited from class org.apache.calcite.plan.RelOptRule

    any, convert, convert, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, onMatch, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • SIMPLE_SORT_RULE

      public static final org.apache.calcite.plan.RelOptRule SIMPLE_SORT_RULE
    • FILTER_SORT_RULE

      public static final org.apache.calcite.plan.RelOptRule FILTER_SORT_RULE
    • pkSortColumns

      protected List<Integer> pkSortColumns
  • Constructor Details

    • KuduSortRule

      public KuduSortRule(org.apache.calcite.plan.RelOptRuleOperand operand, org.apache.calcite.tools.RelBuilderFactory factory, String description)
  • Method Details

    • canApply

      public boolean canApply(org.apache.calcite.plan.RelTraitSet sortTraits, org.apache.calcite.rex.RexNode offset, KuduQuery query, org.apache.kudu.client.KuduTable openedTable, Optional<org.apache.calcite.rel.core.Filter> filter)
    • perform

      public void perform(org.apache.calcite.plan.RelOptRuleCall call, org.apache.calcite.rel.core.Sort originalSort, KuduQuery query, org.apache.kudu.client.KuduTable openedTable, Optional<org.apache.calcite.rel.core.Filter> filter)