try {
// Change PODistinct to use POSortedDistinct, which assume the input
// data is sorted
for (POToChange distinctToChange : distinctsToChange) {
numDistinctChanged++;
PODistinct oldDistinct = (PODistinct) distinctToChange.oper;
String scope = oldDistinct.getOperatorKey().scope;
POSortedDistinct newDistinct = new POSortedDistinct(
new OperatorKey(scope, NodeIdGenerator.getGenerator()
.getNextNodeId(scope)), oldDistinct
.getRequestedParallelism(), oldDistinct
.getInputs());
newDistinct.setInputs(oldDistinct.getInputs());
newDistinct.setResultType(oldDistinct.getResultType());
distinctToChange.plan.replace(oldDistinct, newDistinct);
distinctToChange.forEach.getLeaves();
}
// Removed POSort, if the successor require a databag, we need to
// add a PORelationToExprProject