Class IndexableExprMarker

java.lang.Object
org.apache.calcite.rex.RexVisitorImpl<Boolean>
org.apache.drill.exec.planner.index.IndexableExprMarker
All Implemented Interfaces:
org.apache.calcite.rex.RexVisitor<Boolean>

public class IndexableExprMarker extends org.apache.calcite.rex.RexVisitorImpl<Boolean>
The filter expressions that could be indexed Other than SchemaPaths, which represent columns of a table and could be indexed, we consider only function expressions, and specifically, CAST function. To judge if an expression is indexable, we check these: 1, this expression should be one operand of a comparison operator, one of SqlKind.COMPARISON: IN, EQUALS, NOT_EQUALS, LESS_THAN, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL 2, the expression tree should contain at least one inputRef (which means this expression is a computation on top of at least one column), and if we have more than one indexable expressions are found from operands of comparison operator, we should not take any expression as indexable. 3, (LIMIT to one level function) the expression is a function call, and no nested function call underneath, except ITEM 4, (LIMIT to CAST), the function call is a CAST
  • Constructor Details

    • IndexableExprMarker

      public IndexableExprMarker(org.apache.calcite.rel.RelNode inputRel)
  • Method Details

    • getIndexableExpression

      public Map<org.apache.calcite.rex.RexNode,LogicalExpression> getIndexableExpression()
    • getEqualOnCastChar

      public Map<org.apache.calcite.rex.RexNode,LogicalExpression> getEqualOnCastChar()
    • getExpressionsOnlyInEquality

      public Set<LogicalExpression> getExpressionsOnlyInEquality()
      return the expressions that were only in equality condition _and_ only once. ( a.b = 'value' )
      Returns:
    • visitInputRef

      public Boolean visitInputRef(org.apache.calcite.rex.RexInputRef rexInputRef)
      Specified by:
      visitInputRef in interface org.apache.calcite.rex.RexVisitor<Boolean>
      Overrides:
      visitInputRef in class org.apache.calcite.rex.RexVisitorImpl<Boolean>
    • containInputRef

      public boolean containInputRef(org.apache.calcite.rex.RexNode rex)
    • operandsAreIndexable

      public boolean operandsAreIndexable(org.apache.calcite.rex.RexCall call)
    • visitCall

      public Boolean visitCall(org.apache.calcite.rex.RexCall call)
      Specified by:
      visitCall in interface org.apache.calcite.rex.RexVisitor<Boolean>
      Overrides:
      visitCall in class org.apache.calcite.rex.RexVisitorImpl<Boolean>
    • visitLocalRef

      public Boolean visitLocalRef(org.apache.calcite.rex.RexLocalRef localRef)
      Specified by:
      visitLocalRef in interface org.apache.calcite.rex.RexVisitor<Boolean>
      Overrides:
      visitLocalRef in class org.apache.calcite.rex.RexVisitorImpl<Boolean>
    • visitLiteral

      public Boolean visitLiteral(org.apache.calcite.rex.RexLiteral literal)
      Specified by:
      visitLiteral in interface org.apache.calcite.rex.RexVisitor<Boolean>
      Overrides:
      visitLiteral in class org.apache.calcite.rex.RexVisitorImpl<Boolean>
    • visitOver

      public Boolean visitOver(org.apache.calcite.rex.RexOver over)
      Specified by:
      visitOver in interface org.apache.calcite.rex.RexVisitor<Boolean>
      Overrides:
      visitOver in class org.apache.calcite.rex.RexVisitorImpl<Boolean>
    • visitCorrelVariable

      public Boolean visitCorrelVariable(org.apache.calcite.rex.RexCorrelVariable correlVariable)
      Specified by:
      visitCorrelVariable in interface org.apache.calcite.rex.RexVisitor<Boolean>
      Overrides:
      visitCorrelVariable in class org.apache.calcite.rex.RexVisitorImpl<Boolean>
    • visitDynamicParam

      public Boolean visitDynamicParam(org.apache.calcite.rex.RexDynamicParam dynamicParam)
      Specified by:
      visitDynamicParam in interface org.apache.calcite.rex.RexVisitor<Boolean>
      Overrides:
      visitDynamicParam in class org.apache.calcite.rex.RexVisitorImpl<Boolean>
    • visitRangeRef

      public Boolean visitRangeRef(org.apache.calcite.rex.RexRangeRef rangeRef)
      Specified by:
      visitRangeRef in interface org.apache.calcite.rex.RexVisitor<Boolean>
      Overrides:
      visitRangeRef in class org.apache.calcite.rex.RexVisitorImpl<Boolean>
    • visitFieldAccess

      public Boolean visitFieldAccess(org.apache.calcite.rex.RexFieldAccess fieldAccess)
      Specified by:
      visitFieldAccess in interface org.apache.calcite.rex.RexVisitor<Boolean>
      Overrides:
      visitFieldAccess in class org.apache.calcite.rex.RexVisitorImpl<Boolean>