Package org.eigenbase.rel

Examples of org.eigenbase.rel.SortRel


    super(RelOptRule.some(SortRel.class, Convention.NONE, RelOptRule.any(RelNode.class)), "DrillSortRule");
  }

  @Override
  public void onMatch(RelOptRuleCall call) {
    final SortRel sort = call.rel(0);
    final RelNode input = call.rel(1);
    final RelTraitSet traits = sort.getTraitSet().plus(DrillRel.CONVENTION);
    final RelTraitSet inputTraits = input.getTraitSet().plus(DrillRel.CONVENTION);
    final RelNode convertedInput = convert(input, inputTraits);
    call.transformTo(new DrillSortRel(sort.getCluster(), traits, convertedInput, sort.getCollation()));
  }
View Full Code Here


    super(SortRel.class, srcConvention, Prel.DRILL_PHYSICAL, description);
  }

  @Override
  public boolean matches(RelOptRuleCall call) {
    final SortRel sort = call.rel(0);
    return sort.offset == null && sort.fetch == null;
  }
View Full Code Here

    return sort.offset == null && sort.fetch == null;
  }

  @Override
  public RelNode convert(RelNode r) {
    SortRel rel = (SortRel) r;
    return new SortPrel(rel.getCluster(),
                        rel.getChild().getTraitSet().replace(Prel.DRILL_PHYSICAL).plus(rel.getCollation()),
                        convert(rel.getChild(), rel.getChild().getTraitSet().replace(Prel.DRILL_PHYSICAL)),
                        rel.getCollation());
  }
View Full Code Here

    super(RelOptHelper.any(SortRel.class, Convention.NONE), "DrillSortRule");
  }

  @Override
  public boolean matches(RelOptRuleCall call) {
    final SortRel sort = call.rel(0);
    return sort.offset == null && sort.fetch == null;
  }
View Full Code Here

  }

  @Override
  public void onMatch(RelOptRuleCall call) {

    final SortRel sort = call.rel(0);

    final RelNode input = sort.getChild();
    final RelTraitSet traits = sort.getTraitSet().plus(DrillRel.DRILL_LOGICAL);

    final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
    call.transformTo(new DrillSortRel(sort.getCluster(), traits, convertedInput, sort.getCollation()));
  }
View Full Code Here

    super(RelOptHelper.any(SortRel.class, Convention.NONE), "DrillLimitRule");
  }

  @Override
  public boolean matches(RelOptRuleCall call) {
    final SortRel sort = call.rel(0);
    return sort.offset != null || sort.fetch != null;
  }
View Full Code Here

    return sort.offset != null || sort.fetch != null;
  }

  @Override
  public void onMatch(RelOptRuleCall call) {
    final SortRel incomingSort = call.rel(0);
    final RelTraitSet incomingTraits = incomingSort.getTraitSet();
    RelNode input = incomingSort.getChild();

    // if the Optiq sort rel includes a collation and a limit, we need to create a copy the sort rel that excludes the
    // limit information.
    if (!incomingSort.getCollation().getFieldCollations().isEmpty()) {
      input = incomingSort.copy(incomingTraits, input, incomingSort.getCollation(), null, null);
    }

    RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
    call.transformTo(new DrillLimitRel(incomingSort.getCluster(), convertedInput.getTraitSet().plus(DrillRel.DRILL_LOGICAL), convertedInput, incomingSort.offset, incomingSort.fetch));
  }
View Full Code Here

        ASTConverter.this.groupBy = (AggregateRelBase) node;
      } else if (node instanceof SortRel) {
        if (ASTConverter.this.select != null) {
          ASTConverter.this.from = node;
        } else {
          SortRel hiveSortRel = (SortRel) node;
          if (hiveSortRel.getCollation().getFieldCollations().isEmpty())
            ASTConverter.this.limit = hiveSortRel;
          else
            ASTConverter.this.order = hiveSortRel;
        }
      }
View Full Code Here

    super(SortRel.class, srcConvention, Prel.DRILL_PHYSICAL, description);
  }

  @Override
  public boolean matches(RelOptRuleCall call) {
    final SortRel sort = call.rel(0);
    return sort.offset == null && sort.fetch == null;
  }
View Full Code Here

    return sort.offset == null && sort.fetch == null;
  }

  @Override
  public RelNode convert(RelNode r) {
    SortRel rel = (SortRel) r;
    return new SortPrel(rel.getCluster(),
                        rel.getChild().getTraitSet().replace(Prel.DRILL_PHYSICAL).plus(rel.getCollation()),
                        convert(rel.getChild(), rel.getChild().getTraitSet().replace(Prel.DRILL_PHYSICAL)),
                        rel.getCollation());
  }
View Full Code Here

TOP

Related Classes of org.eigenbase.rel.SortRel

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.