@Override
public void transform(OperatorPlan matched) throws FrontendException {
if (matched == null || matched instanceof LOSplit || matched instanceof LOStore
|| matched.size() != 1)
throw new FrontendException("Invalid match in ImplicitSplitInserter rule.", 2244);
// For two successors of op here is a pictorial
// representation of the change required:
// BEFORE:
// Succ1 Succ2
// \ /
// op
// SHOULD BECOME:
// AFTER:
// Succ1 Succ2
// | |
// SplitOutput SplitOutput
// \ /
// Split
// |
// op
Operator op = matched.getSources().get(0);
List<Operator> succs = currentPlan.getSuccessors(op);
if (succs == null || succs.size() < 2)
throw new FrontendException("Invalid match in ImplicitSplitInserter rule.", 2243);
LOSplit splitOp = new LOSplit(currentPlan);
splitOp.setAlias(((LogicalRelationalOperator) op).getAlias());
Operator[] sucs = succs.toArray(new Operator[0]);
currentPlan.add(splitOp);
currentPlan.connect(op, splitOp);