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.
  • Method Details

    • iterator

      public Iterator<LogicalExpression> iterator()
      Specified by:
      iterator in interface Iterable<C extends Comparable<C>>
    • accept

      public <T, V, E extends Exception> T accept(ExprVisitor<T,V,E> visitor, V value) throws E
      Specified by:
      accept in interface LogicalExpression
      Throws:
      E extends Exception
    • matches

      public RowsMatch matches(StatisticsProvider<C> evaluator)
      Semantics of matches() is very similar to what is implemented in Parquet library's StatisticsFilter and FilterPredicate 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 interface FilterPredicate<C extends Comparable<C>>
    • createComparisonPredicate

      public static <C extends Comparable<C>> LogicalExpression createComparisonPredicate(String function, LogicalExpression left, LogicalExpression right)