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>
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
-
Field Summary
Fields inherited from class org.apache.calcite.rex.RexVisitorImpl
deep
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containInputRef
(org.apache.calcite.rex.RexNode rex) Map<org.apache.calcite.rex.RexNode,
LogicalExpression> return the expressions that were only in equality condition _and_ only once.Map<org.apache.calcite.rex.RexNode,
LogicalExpression> boolean
operandsAreIndexable
(org.apache.calcite.rex.RexCall call) visitCall
(org.apache.calcite.rex.RexCall call) visitCorrelVariable
(org.apache.calcite.rex.RexCorrelVariable correlVariable) visitDynamicParam
(org.apache.calcite.rex.RexDynamicParam dynamicParam) visitFieldAccess
(org.apache.calcite.rex.RexFieldAccess fieldAccess) visitInputRef
(org.apache.calcite.rex.RexInputRef rexInputRef) visitLiteral
(org.apache.calcite.rex.RexLiteral literal) visitLocalRef
(org.apache.calcite.rex.RexLocalRef localRef) visitOver
(org.apache.calcite.rex.RexOver over) visitRangeRef
(org.apache.calcite.rex.RexRangeRef rangeRef) Methods inherited from class org.apache.calcite.rex.RexVisitorImpl
visitArrayAnd, visitArrayOr, visitPatternFieldRef, visitSubQuery, visitTableInputRef
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.calcite.rex.RexVisitor
visitEach, visitList, visitList
-
Constructor Details
-
IndexableExprMarker
public IndexableExprMarker(org.apache.calcite.rel.RelNode inputRel)
-
-
Method Details
-
getIndexableExpression
-
getEqualOnCastChar
-
getExpressionsOnlyInEquality
return the expressions that were only in equality condition _and_ only once. ( a.b = 'value' )- Returns:
-
visitInputRef
-
containInputRef
public boolean containInputRef(org.apache.calcite.rex.RexNode rex) -
operandsAreIndexable
public boolean operandsAreIndexable(org.apache.calcite.rex.RexCall call) -
visitCall
-
visitLocalRef
-
visitLiteral
-
visitOver
-
visitCorrelVariable
-
visitDynamicParam
-
visitRangeRef
-
visitFieldAccess
-