aggregateOverFields = mGroupBy.getFieldTypes();
}
LOG.debug("Aggregate exprs: " + StringUtils.listToStr(mAggregateExprs));
assert flowSpec.getConf() != null;
PlanNode aggregateNode = new AggregateNode(aggregateOverFields,
mAggregateOver, mAggregateExprs, groupByPropagateFields, flowSpec.getConf());
flowSpec.attachToLastLayer(aggregateNode);
// Output schema for this layer contains everything we need to forward
// from our upstream layers...
List<TypedField> aggOutputFields = new ArrayList<TypedField>();
aggOutputFields.addAll(groupByPropagateFields);
// As well as the names of everything we calculate in this layer.
for (AliasedExpr aliasExpr : mAggregateExprs) {
Expr e = aliasExpr.getExpr();
Type t = e.getType(fieldSymbols);
TypedField aggregateField = new TypedField(
aliasExpr.getUserAlias(), t,
aliasExpr.getAvroLabel(), aliasExpr.getDisplayLabel());
aggOutputFields.add(aggregateField);
}
Schema aggregateOutSchema = createFieldSchema(aggOutputFields);
aggregateNode.setAttr(PlanNode.OUTPUT_SCHEMA_ATTR, aggregateOutSchema);
}
}