private RelNode convertToStormRel(RelNode relNode) throws RelConversionException { RelTraitSet traitSet = relNode.getTraitSet(); traitSet = traitSet.simplify(); // PlannerImpl.transform() optimizes RelNode with ruleset return planner.transform(STORM_REL_CONVERSION_RULES, traitSet.plus(StreamsLogicalConvention.INSTANCE), relNode); }
@Override public RelNode convert(RelNode in) { return new JdbcDrel(in.getCluster(), in.getTraitSet().replace(DrillRel.DRILL_LOGICAL), convert(in, in.getTraitSet().replace(this.getInTrait()).simplify())); }
@Override public RelNode convert(RelNode rel) { LogicalFilter filter = (LogicalFilter) rel; RelTraitSet origTraitSet = filter.getTraitSet(); RelTraitSet traitSet = origTraitSet.replace(OLAPRel.CONVENTION).simplify(); return new OLAPFilterRel(filter.getCluster(), traitSet, convert(filter.getInput(), filter.getInput().getTraitSet().replace(OLAPRel.CONVENTION)), filter.getCondition()); } }
public RelNode convert(RelNode rel) { LogicalFilter filter = (LogicalFilter) rel; return new JdbcRules.JdbcFilter(rel.getCluster(), rel.getTraitSet().replace(this.out), convert(filter.getInput(), filter.getInput().getTraitSet().replace(this.out).simplify()), filter.getCondition()); }
@Override public void onMatch(RelOptRuleCall call) { final Sort sort = call.rel(0); if (sort.offset == null && sort.fetch == null) { return; } RelTraitSet origTraitSet = sort.getTraitSet(); RelTraitSet traitSet = origTraitSet.replace(OLAPRel.CONVENTION).simplify(); RelNode input = sort.getInput(); if (!sort.getCollation().getFieldCollations().isEmpty()) { // Create a sort with the same sort key, but no offset or fetch. input = sort.copy(sort.getTraitSet(), input, sort.getCollation(), null, null); } RelNode x = convert(input, input.getTraitSet().replace(OLAPRel.CONVENTION)); call.transformTo(new OLAPLimitRel(sort.getCluster(), traitSet, x, sort.offset, sort.fetch)); }
public RelNode convert(RelNode rel) { LogicalProject project = (LogicalProject) rel; return new JdbcRules.JdbcProject(rel.getCluster(), rel.getTraitSet().replace(this.out), convert( project.getInput(), project.getInput().getTraitSet().replace(this.out).simplify()), project.getProjects(), project.getRowType()); }
public static RelNode convert(RelNode rel, RelTraitSet toTraits){ toTraits = toTraits.simplify(); PlannerSettings settings = PrelUtil.getSettings(rel.getCluster()); if(settings.isSingleMode()){ toTraits = toTraits.replace(DistributionTrait.ANY); } return RelOptRule.convert(rel, toTraits.simplify()); }
protected RelTraitSet getDesiredRootTraitSet(RelRoot root) { // Make sure non-CallingConvention traits, if any, are preserved return root.rel.getTraitSet() .replace(resultConvention) .replace(root.collation) .simplify(); }
@Override public RelNode createFilter(RelNode child, RexNode condition) { return FilterRel.create( RelOptRule.convert(child, child.getTraitSet().plus(Rel.LOGICAL).simplify()), condition); } }
/** * Adds a relational expression to a set, with its results available under a * particular calling convention. An expression may be in the set several * times with different calling conventions (and hence different costs). */ public RelSubset add(RelNode rel) { assert equivalentSet == null : "adding to a dead set"; final RelTraitSet traitSet = rel.getTraitSet().simplify(); final RelSubset subset = getOrCreateSubset(rel.getCluster(), traitSet); subset.add(rel); return subset; }
/** * Adds a relational expression to a set, with its results available under a * particular calling convention. An expression may be in the set several * times with different calling conventions (and hence different costs). */ public RelSubset add(RelNode rel) { assert equivalentSet == null : "adding to a dead set"; final RelTraitSet traitSet = rel.getTraitSet().simplify(); final RelSubset subset = getOrCreateSubset(rel.getCluster(), traitSet); subset.add(rel); return subset; }
@Override public void onMatch(RelOptRuleCall call) { final RelNode input = call.rel(1); call.transformTo(convert(input, input.getTraitSet().plus(Rel.LOGICAL).simplify())); } }
@Override public RelNode createJoin(RelNode left, RelNode right, RexNode condition, JoinRelType joinType, Set<String> variablesStopped, boolean semiJoinDone) { return new JoinRel( left.getCluster(), left.getTraitSet().plus(Rel.LOGICAL), RelOptRule.convert(left, left.getTraitSet().plus(Rel.LOGICAL).simplify()), RelOptRule.convert(right, right.getTraitSet().plus(Rel.LOGICAL).simplify()), condition, joinType); } }
@Override public RelNode convert(RelNode r) { Sort rel = (Sort) r; RelTraitSet traits = rel.getInput().getTraitSet().replace(Prel.DRILL_PHYSICAL); return new SortPrel(rel.getCluster(), traits.plus(rel.getCollation()), convert(rel.getInput(), traits.simplify()), rel.getCollation()); } }
@Override public void onMatch(RelOptRuleCall call) { final SampleCrel sample = call.rel(0); final RelNode input = sample.getInput(); final RelNode convertedInput = convert(input, input.getTraitSet().plus(Rel.LOGICAL).simplify()); call.transformTo(new SampleRel(sample.getCluster(), convertedInput.getTraitSet().plus(Rel.LOGICAL), convertedInput)); } }
@Override public void onMatch(RelOptRuleCall call) { final Sort sort = call.rel(0); final RelNode input = sort.getInput(); final RelTraitSet traits = sort.getTraitSet().plus(DrillRel.DRILL_LOGICAL); final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify()); call.transformTo(new DrillSortRel(sort.getCluster(), traits, convertedInput, sort.getCollation())); } }
@Override public void onMatch(RelOptRuleCall call) { final Sort sort = call.rel(0); final RelNode input = sort.getInput(); final RelTraitSet traits = sort.getTraitSet().plus(Rel.LOGICAL); final RelNode convertedInput = convert(input, input.getTraitSet().plus(Rel.LOGICAL).simplify()); call.transformTo(new SortRel(sort.getCluster(), traits, convertedInput, sort.getCollation())); } }
@Override public void onMatch(RelOptRuleCall call) { final Project toTransform = call.rel(0); final RelNode input = toTransform.getInput(); final RelTraitSet traits = toTransform.getTraitSet().plus(Rel.LOGICAL); final RelNode convertedInput = convert(input, input.getTraitSet().plus(Rel.LOGICAL).simplify()); call.transformTo(new ProjectRel(toTransform.getCluster(), traits, convertedInput, toTransform.getProjects(), toTransform.getRowType())); } }
@Override public RelNode convert(RelNode r) { Sort rel = (Sort) r; return new SortPrel(rel.getCluster(), rel.getInput().getTraitSet().replace(Prel.PHYSICAL).plus(rel.getCollation()), convert(rel.getInput(), rel.getInput().getTraitSet().replace(Prel.PHYSICAL).simplify()), rel.getCollation()); } }
@Override public void onMatch(RelOptRuleCall call) { final FlattenCrel flattenRel = call.rel(0); final RelNode convertedInput = convert(flattenRel.getInput(), flattenRel.getInput().getTraitSet().plus(Rel.LOGICAL).simplify()); call.transformTo(new FlattenRel( flattenRel.getCluster(), flattenRel.getInput().getTraitSet().plus(Rel.LOGICAL), convertedInput, flattenRel.getToFlatten(), flattenRel.getNumProjectsPushed())); } }