@Override public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { // Prel child = (Prel) this.getChild(); final List<String> childFields = getChild().getRowType().getFieldNames(); final List<String> fields = getRowType().getFieldNames(); List<NamedExpression> keys = Lists.newArrayList(); List<NamedExpression> exprs = Lists.newArrayList(); for (int group : BitSets.toIter(groupSet)) { FieldReference fr = new FieldReference(childFields.get(group), ExpressionPosition.UNKNOWN); keys.add(new NamedExpression(fr, fr)); } for (Ord<AggregateCall> aggCall : Ord.zip(aggCalls)) { FieldReference ref = new FieldReference(fields.get(groupSet.cardinality() + aggCall.i)); LogicalExpression expr = toDrill(aggCall.e, childFields, new DrillParseContext()); exprs.add(new NamedExpression(expr, ref)); } Prel child = (Prel) this.getChild(); StreamingAggregate g = new StreamingAggregate( child.getPhysicalOperator(creator), keys.toArray(new NamedExpression[keys.size()]), exprs.toArray(new NamedExpression[exprs.size()]), 1.0f); return g; }
@Override public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); org.apache.drill.exec.physical.config.Sort g = new ExternalSort( childPOP, PrelUtil.getOrdering(this.collation, getInput().getRowType()), false); return creator.addMetadata(this, g); }
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getChild(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); if (PrelUtil.getSettings(getCluster()).isSingleMode()) return childPOP; HashToMergeExchange g = new HashToMergeExchange( childPOP, PrelUtil.getHashExpression(this.distFields, getChild().getRowType()), PrelUtil.getOrdering(this.collation, getChild().getRowType())); g.setOperatorId(creator.getOperatorId(this)); return g; }