Class ReduceExpressionsRule.FilterReduceExpressionsRule

  • Enclosing class:

    public static class ReduceExpressionsRule.FilterReduceExpressionsRule
    extends ReduceExpressionsRule
    Rule that reduces constants inside a Filter. If the condition is a constant, the filter is removed (if TRUE) or replaced with an empty Values (if FALSE or NULL).
    • Constructor Detail

      • FilterReduceExpressionsRule

        public FilterReduceExpressionsRule​(java.lang.Class<? extends Filter> filterClass,
                                           RelBuilderFactory relBuilderFactory)
      • FilterReduceExpressionsRule

        public FilterReduceExpressionsRule​(java.lang.Class<? extends Filter> filterClass,
                                           boolean matchNullability,
                                           RelBuilderFactory relBuilderFactory)
    • Method Detail

      • createEmptyRelOrEquivalent

        protected RelNode createEmptyRelOrEquivalent​(RelOptRuleCall call,
                                                     Filter input)
        For static schema systems, a filter that is always false or null can be replaced by a values operator that produces no rows, as the schema information can just be taken from the input Rel. In dynamic schema environments, the filter might have an unknown input type, in these cases they must define a system specific alternative to a Values operator, such as inserting a limit 0 instead of a filter on top of the original input.

        The default implementation of this method is to call RelBuilder.empty(), which for the static schema will be optimized to an empty Values.

        input - rel to replace, assumes caller has already determined equivalence to Values operation for 0 records or a false filter.
        equivalent but less expensive replacement rel
      • reduceNotNullableFilter

        private void reduceNotNullableFilter​(RelOptRuleCall call,
                                             Filter filter,
                                             RexNode rexNode,
                                             boolean reverse)