/**
* The Node Processor for Column Pruning on Select Operators.
*/
public static class ColumnPrunerSelectProc implements NodeProcessor {
public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx ctx, Object... nodeOutputs) throws SemanticException {
SelectOperator op = (SelectOperator)nd;
ColumnPrunerProcCtx cppCtx = (ColumnPrunerProcCtx)ctx;
List<String> cols = new ArrayList<String>();
if(op.getChildOperators() != null) {
for(Operator<? extends Serializable> child: op.getChildOperators()) {
// If one of my children is a FileSink or Script, return all columns.
// Without this break, a bug in ReduceSink to Extract edge column pruning will manifest
// which should be fixed before remove this
if ((child instanceof FileSinkOperator) || (child instanceof ScriptOperator)) {
cppCtx.getPrunedColLists().put(op, cppCtx.getColsFromSelectExpr(op));
return null;
}
cols = Utilities.mergeUniqElems(cols, cppCtx.getPrunedColLists().get(child));
}
}
selectDesc conf = op.getConf();
if (conf.isSelectStar() && !cols.isEmpty()) {
// The input to the select does not matter. Go over the expressions
// and return the ones which have a marked column
cppCtx.getPrunedColLists().put(op, cppCtx.getSelectColsFromChildren(op, cols));
return null;