public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx,
Object... nodeOutputs) throws SemanticException {
Operator<? extends OperatorDesc> op = (Operator<? extends OperatorDesc>) nd;
VectorizationContext vContext = null;
if (op instanceof TableScanOperator) {
vContext = getVectorizationContext((TableScanOperator) op, physicalContext);
for (String onefile : mWork.getPathToAliases().keySet()) {
List<String> aliases = mWork.getPathToAliases().get(onefile);
for (String alias : aliases) {
Operator<? extends OperatorDesc> opRoot = mWork.getAliasToWork().get(alias);
if (op == opRoot) {
// The same vectorization context is copied multiple times into
// the MapWork scratch columnMap
// Each partition gets a copy
//
vContext.setFileKey(onefile);
scratchColumnContext.put(onefile, vContext);
break;
}
}
}
vContextsByTSOp.put(op, vContext);
} else {
assert stack.size() > 1;
// Walk down the stack of operators until we found one willing to give us a context.
// At the bottom will be the TS operator, guaranteed to have a context
int i= stack.size()-2;
while (vContext == null) {
Operator<? extends OperatorDesc> opParent = (Operator<? extends OperatorDesc>) stack.get(i);
vContext = vContextsByTSOp.get(opParent);
--i;
}
}
assert vContext != null;
if ((op.getType().equals(OperatorType.REDUCESINK) || op.getType().equals(OperatorType.FILESINK)) &&
op.getParentOperators().get(0).getType().equals(OperatorType.GROUPBY)) {
// No need to vectorize
if (!opsDone.contains(op)) {
opsDone.add(op);
}
} else {
try {
if (!opsDone.contains(op)) {
Operator<? extends OperatorDesc> vectorOp =
vectorizeOperator(op, vContext);
opsDone.add(op);
if (vectorOp != op) {
opsDone.add(vectorOp);
}
if (vectorOp instanceof VectorizationContextRegion) {
VectorizationContextRegion vcRegion = (VectorizationContextRegion) vectorOp;
VectorizationContext vOutContext = vcRegion.getOuputVectorizationContext();
vContextsByTSOp.put(op, vOutContext);
scratchColumnContext.put(vOutContext.getFileKey(), vOutContext);
}
}
} catch (HiveException e) {
throw new SemanticException(e);
}