Package org.apache.drill.exec.expr
Class ComparisonPredicate<C extends Comparable<C>>
java.lang.Object
org.apache.drill.common.expression.LogicalExpressionBase
org.apache.drill.exec.expr.ComparisonPredicate<C>
- All Implemented Interfaces:
Iterable<LogicalExpression>
,LogicalExpression
,FilterPredicate<C>
public class ComparisonPredicate<C extends Comparable<C>>
extends LogicalExpressionBase
implements FilterPredicate<C>
Comparison predicates for metadata filter pushdown.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.drill.common.expression.LogicalExpression
LogicalExpression.De, LogicalExpression.Se
-
Method Summary
Modifier and TypeMethodDescription<T,
V, E extends Exception>
Taccept
(ExprVisitor<T, V, E> visitor, V value) static <C extends Comparable<C>>
LogicalExpressioncreateComparisonPredicate
(String function, LogicalExpression left, LogicalExpression right) iterator()
matches
(StatisticsProvider<C> evaluator) Semantics of matches() is very similar to what is implemented in Parquet library'sStatisticsFilter
andFilterPredicate
Main difference : 1.Methods inherited from class org.apache.drill.common.expression.LogicalExpressionBase
getCumulativeCost, getDescription, getMajorType, getPosition, getSelfCost, i
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
iterator
- Specified by:
iterator
in interfaceIterable<C extends Comparable<C>>
-
accept
- Specified by:
accept
in interfaceLogicalExpression
- Throws:
E extends Exception
-
matches
Semantics of matches() is very similar to what is implemented in Parquet library'sStatisticsFilter
andFilterPredicate
Main difference : 1. A RangeExprEvaluator is used to compute the min/max of an expression, such as CAST function of a column. CAST function could be explicitly added by Drill user (It's recommended to use CAST function after DRILL-4372, if user wants to reduce planning time for limit 0 query), or implicitly inserted by Drill, when the types of compare operands are not identical. Therefore, it's important to allow CAST function to appear in the filter predicate. 2. We do not require list of ColumnChunkMetaData to do the evaluation, while Parquet library's StatisticsFilter has such requirement. Drill's ParquetTableMetaData does not maintain ColumnChunkMetaData, making it impossible to directly use Parquet library's StatisticFilter in query planning time. 3. We allows both sides of comparison operator to be a min/max range. As such, we support expression_of(Column1) < expression_of(Column2), where Column1 and Column2 are from same parquet table.- Specified by:
matches
in interfaceFilterPredicate<C extends Comparable<C>>
-
createComparisonPredicate
public static <C extends Comparable<C>> LogicalExpression createComparisonPredicate(String function, LogicalExpression left, LogicalExpression right)
-