@Override
  public void onMatch(RelOptRuleCall call) {
    final Filter filter = call.rel(0);

    final RexBuilder rexBuilder = filter.getCluster().getRexBuilder();
    final RelMetadataQuery metadataProvider = call.getMetadataQuery();

    // 1. Recompose filter possibly by pulling out common elements from DNF
    // expressions
    RexNode newFilterCondition = RexUtil.pullFactors(rexBuilder, filter.getCondition());

    // 2. Reduce filter with stats information
    RexReplacer replacer = new RexReplacer(filter, rexBuilder, metadataProvider);
    newFilterCondition = replacer.apply(newFilterCondition);

    // 3. Transform if we have created a new filter operator
    if (!filter.getCondition().toString().equals(newFilterCondition.toString())) {
      Filter newFilter = filter.copy(filter.getTraitSet(), filter.getInput(), newFilterCondition);
      call.transformTo(newFilter);
    }

  }
This rule simplifies the condition in Filter operators using the
column statistics (if available).

For instance, given the following predicate:
  a &gt; 5
we can infer that the predicate will evaluate to false if the max
value for column a is 4.

Currently we support the simplification of:
 - =, &gt;=, &lt;=, &gt;, &lt;
 - IN
 - IS_NULL / IS_NOT_NULL
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveReduceExpressionsWithStatsRule.java