private void translateCollectedCogroup(LOCogroup cg) throws FrontendException {
// can have only one input
LogicalRelationalOperator pred = (LogicalRelationalOperator) plan.getPredecessors(cg).get(0);
List<LogicalExpressionPlan> exprPlans = cg.getExpressionPlans().get(0);
POCollectedGroup physOp = new POCollectedGroup(new OperatorKey(
DEFAULT_SCOPE, nodeGen.getNextNodeId(DEFAULT_SCOPE)));
physOp.addOriginalLocation(cg.getAlias(), cg.getLocation());
List<PhysicalPlan> pExprPlans = translateExpressionPlans(cg, exprPlans);
try {
physOp.setPlans(pExprPlans);
} catch (PlanException pe) {
int errCode = 2071;
String msg = "Problem with setting up map group's plans.";
throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, pe);
}
Byte type = null;
if (exprPlans.size() > 1) {
type = DataType.TUPLE;
physOp.setKeyType(type);
} else {
type = pExprPlans.get(0).getLeaves().get(0).getResultType();
physOp.setKeyType(type);
}
physOp.setResultType(DataType.TUPLE);
currentPlan.add(physOp);
try {
currentPlan.connect(logToPhyMap.get(pred), physOp);