Package org.eigenbase.rel

Examples of org.eigenbase.rel.RelNode


  }

  @Override
  public void onMatch(RelOptRuleCall call) {
    final AggregateRel aggregate = (AggregateRel) call.rel(0);
    final RelNode input = call.rel(1);
    final RelTraitSet traits = aggregate.getTraitSet().plus(DrillRel.CONVENTION);
    final RelNode convertedInput = convert(input, traits);
    try {
      call.transformTo(new DrillAggregateRel(aggregate.getCluster(), traits, convertedInput, aggregate.getGroupSet(),
          aggregate.getAggCallList()));
    } catch (InvalidRelException e) {
      tracer.warning(e.toString());
View Full Code Here


  }

  @Override
  public void onMatch(RelOptRuleCall call) {
    final JoinRel join = (JoinRel) call.rel(0);
    final RelNode left = call.rel(1);
    final RelNode right = call.rel(2);
    final RelTraitSet traits = join.getTraitSet().plus(DrillRel.CONVENTION);

    final RelNode convertedLeft = convert(left, traits);
    final RelNode convertedRight = convert(right, traits);
    try {
      call.transformTo(new DrillJoinRel(join.getCluster(), traits, convertedLeft, convertedRight, join.getCondition(),
          join.getJoinType()));
    } catch (InvalidRelException e) {
      tracer.warning(e.toString());
View Full Code Here

  public void onMatch(RelOptRuleCall call) {
    final UnionRel union = (UnionRel) call.rel(0);
    final RelTraitSet traits = union.getTraitSet().plus(DrillRel.CONVENTION);
    final List<RelNode> convertedInputs = new ArrayList<>();
    for (RelNode input : union.getInputs()) {
      final RelNode convertedInput = convert(input, traits);
      convertedInputs.add(convertedInput);
    }
    call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all));
  }
View Full Code Here

            RexNode arg2 = rexBuilder.makeLiteral(types);
            rexNodes = new RexNode[] { arg1, arg2 };
        }

        // Call to super handles the rest.
        RelNode udxRel =
            toUdxRel(
                cluster,
                connection,
                this.udxSpecificName,
                server.getServerMofId(),
View Full Code Here

                true);

        // Create a relational algebra expression for invoking the UDX.
        RexNode rexCall = rexBuilder.makeCall(udx, args);

        RelNode udxRel =
            new SfdcUdxRel(
                cluster,
                rexCall,
                resultType,
                serverMofId,
View Full Code Here

  }

  @Override
  public void onMatch(RelOptRuleCall call) {
    final DrillAggregateRel aggregate = (DrillAggregateRel) call.rel(0);
    final RelNode input = call.rel(1);

    if (aggregate.containsDistinctCall() || aggregate.getGroupCount() == 0) {
      // currently, don't use HashAggregate if any of the logical aggrs contains DISTINCT or
      // if there are no grouping keys
      return;
    }

    RelTraitSet traits = null;

    try {
      if (aggregate.getGroupSet().isEmpty()) {
        DrillDistributionTrait singleDist = DrillDistributionTrait.SINGLETON;
        traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(singleDist);
        createTransformRequest(call, aggregate, input, traits);
      } else {
        // hash distribute on all grouping keys
        DrillDistributionTrait distOnAllKeys =
            new DrillDistributionTrait(DrillDistributionTrait.DistributionType.HASH_DISTRIBUTED,
                                       ImmutableList.copyOf(getDistributionField(aggregate, true /* get all grouping keys */)));

        traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(distOnAllKeys);
        createTransformRequest(call, aggregate, input, traits);

        // hash distribute on single grouping key
        DrillDistributionTrait distOnOneKey =
            new DrillDistributionTrait(DrillDistributionTrait.DistributionType.HASH_DISTRIBUTED,
                                       ImmutableList.copyOf(getDistributionField(aggregate, false /* get single grouping key */)));

        traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(distOnOneKey);
        createTransformRequest(call, aggregate, input, traits);

        if (create2PhasePlan(call, aggregate)) {
          traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL) ;

          RelNode convertedInput = convert(input, traits);
          new TwoPhaseSubset(call, distOnAllKeys).go(aggregate, convertedInput);

        }
      }
    } catch (InvalidRelException e) {
View Full Code Here

  }

  private void createTransformRequest(RelOptRuleCall call, DrillAggregateRel aggregate,
                                      RelNode input, RelTraitSet traits) throws InvalidRelException {

    final RelNode convertedInput = convert(input, PrelUtil.fixTraits(call, traits));

    HashAggPrel newAgg = new HashAggPrel(aggregate.getCluster(), traits, convertedInput, aggregate.getGroupSet(),
                                         aggregate.getAggCallList(), OperatorPhase.PHASE_1of1);

    call.transformTo(newAgg);
View Full Code Here

    @Override
    public RelNode convertChild(DrillAggregateRel aggregate, RelNode input) throws InvalidRelException {

      RelTraitSet traits = newTraitSet(Prel.DRILL_PHYSICAL, input.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE));
      RelNode newInput = convert(input, traits);

      HashAggPrel phase1Agg = new HashAggPrel(aggregate.getCluster(), traits, newInput,
          aggregate.getGroupSet(),
          aggregate.getAggCallList(),
          OperatorPhase.PHASE_1of2);
View Full Code Here

    f.setInput(input);
    return f;
  }
 
  public static DrillFilterRel convert(Filter filter, ConversionContext context) throws InvalidRelException{
    RelNode input = context.toRel(filter.getInput());
    return new DrillFilterRel(context.getCluster(), context.getLogicalTraits(), input, context.toRex(filter.getExpr()));
  }
View Full Code Here

  }

  @Override
  public RelNode toRel(ToRelContext context, RelOptTable relOptTable) {
    RelDataType rowType = relOptTable.getRowType();
    RelNode rel = context.expandView(rowType, view.getSql(), view.getWorkspaceSchemaPath());

    if (view.isDynamic()){
      return rel;
    }else{
      // if the View's field list is not "*", try to create a cast.
View Full Code Here

TOP

Related Classes of org.eigenbase.rel.RelNode

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.