Package org.eigenbase.rel

Examples of org.eigenbase.rel.FilterRelBase


          HiveProjectRel.DEFAULT_PROJECT_FACTORY);
    }

    @Override
    public void onMatch(RelOptRuleCall call) {
      FilterRelBase filter = call.rel(0);
      JoinRelBase join = call.rel(1);
      super.perform(call, filter, join);
    }
View Full Code Here


            operand(FilterRelBase.class, any())));
  }

  public void onMatch(RelOptRuleCall call) {
    final AggregateRelBase aggregate = call.rel(0);
    final FilterRelBase filter = call.rel(1);

    // Do the columns used by the filter appear in the output of the aggregate?
    final BitSet filterColumns =
        RelOptUtil.InputFinder.bits(filter.getCondition());
    final BitSet newGroupSet =
        BitSets.union(aggregate.getGroupSet(), filterColumns);
    final RelNode input = filter.getChild();
    final Boolean unique =
        RelMetadataQuery.areColumnsUnique(input, newGroupSet);
    if (unique != null && unique) {
      // The input is already unique on the grouping columns, so there's little
      // advantage of aggregating again. More important, without this check,
      // the rule fires forever: A-F => A-F-A => A-A-F-A => A-A-A-F-A => ...
      return;
    }
    final AggregateRelBase newAggregate =
        aggregate.copy(aggregate.getTraitSet(), input, newGroupSet,
            aggregate.getAggCallList());
    final Mappings.TargetMapping mapping = Mappings.target(
        new Function<Integer, Integer>() {
          public Integer apply(Integer a0) {
            return BitSets.toList(newGroupSet).indexOf(a0);
          }
        },
        input.getRowType().getFieldCount(),
        newGroupSet.cardinality());
    final RexNode newCondition =
        RexUtil.apply(mapping, filter.getCondition());
    final FilterRelBase newFilter = filter.copy(filter.getTraitSet(),
        newAggregate, newCondition);
    if (BitSets.contains(aggregate.getGroupSet(), filterColumns)) {
      // Everything needed by the filter is returned by the aggregate.
      assert newGroupSet.equals(aggregate.getGroupSet());
      call.transformTo(newFilter);
View Full Code Here

TOP

Related Classes of org.eigenbase.rel.FilterRelBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.