@Override
public Object process(Node nd, Stack<Node> stack,
NodeProcessorCtx procCtx, Object... nodeOutputs)
throws SemanticException {
ReduceSinkDeduplicateProcCtx ctx = (ReduceSinkDeduplicateProcCtx) procCtx;
ReduceSinkOperator childReduceSink = (ReduceSinkOperator)nd;
if(ctx.contains(childReduceSink)) {
return null;
}
List<Operator<? extends Serializable>> childOp = childReduceSink.getChildOperators();
if (childOp != null && childOp.size() == 1 && childOp.get(0) instanceof GroupByOperator) {
ctx.addRejectedReduceSinkOperator(childReduceSink);
return null;
}
ParseContext pGraphContext = ctx.getPctx();
HashMap<String, String> childColumnMapping = getPartitionAndKeyColumnMapping(childReduceSink);
ReduceSinkOperator parentRS = null;
parentRS = findSingleParentReduceSink(childReduceSink, pGraphContext);
if (parentRS == null) {
ctx.addRejectedReduceSinkOperator(childReduceSink);
return null;
}
HashMap<String, String> parentColumnMapping = getPartitionAndKeyColumnMapping(parentRS);
Operator<? extends Serializable> stopBacktrackFlagOp = null;
if (parentRS.getParentOperators() == null
|| parentRS.getParentOperators().size() == 0) {
stopBacktrackFlagOp = parentRS;
} else if (parentRS.getParentOperators().size() != 1) {
return null;
} else {
stopBacktrackFlagOp = parentRS.getParentOperators().get(0);
}
boolean succeed = backTrackColumnNames(childColumnMapping, childReduceSink, stopBacktrackFlagOp, pGraphContext);
if (!succeed) {
return null;