* @return partial aggregate operator
* @throws CloneNotSupportedException
*/
private static POPartialAgg createPartialAgg(POForEach combineFE) throws CloneNotSupportedException {
String scope = combineFE.getOperatorKey().scope;
POPartialAgg poAgg = new POPartialAgg(new OperatorKey(scope,
NodeIdGenerator.getGenerator().getNextNodeId(scope)));
poAgg.addOriginalLocation(combineFE.getAlias(), combineFE.getOriginalLocations());
poAgg.setResultType(combineFE.getResultType());
// first plan in combine foreach is the group key
poAgg.setKeyPlan(combineFE.getInputPlans().get(0).clone());
List<PhysicalPlan> valuePlans = Lists.newArrayList();
for (int i=1; i<combineFE.getInputPlans().size(); i++) {
valuePlans.add(combineFE.getInputPlans().get(i).clone());
}
poAgg.setValuePlans(valuePlans);
return poAgg;
}