cppCtx.getPrunedColLists().put((Operator<? extends OperatorDesc>) nd,
cols);
ArrayList<Integer> needed_columns = new ArrayList<Integer>();
List<String> neededColumnNames = new ArrayList<String>();
RowResolver inputRR = cppCtx.getOpToParseCtxMap().get(scanOp).getRowResolver();
TableScanDesc desc = scanOp.getConf();
List<VirtualColumn> virtualCols = desc.getVirtualCols();
List<VirtualColumn> newVirtualCols = new ArrayList<VirtualColumn>();
// add virtual columns for ANALYZE TABLE
if(scanOp.getConf().isGatherStats()) {
cols.add(VirtualColumn.RAWDATASIZE.getName());
}
for (int i = 0; i < cols.size(); i++) {
String[] tabCol = inputRR.reverseLookup(cols.get(i));
if(tabCol == null) {
continue;
}
ColumnInfo colInfo = inputRR.get(tabCol[0], tabCol[1]);
if (colInfo.getIsVirtualCol()) {
// part is also a virtual column, but part col should not in this
// list.
for (int j = 0; j < virtualCols.size(); j++) {
VirtualColumn vc = virtualCols.get(j);
if (vc.getName().equals(colInfo.getInternalName())) {
newVirtualCols.add(vc);
}
}
//no need to pass virtual columns to reader.
continue;
}
int position = inputRR.getPosition(cols.get(i));
if (position >=0) {
// get the needed columns by id and name
needed_columns.add(position);
neededColumnNames.add(cols.get(i));
}
}
desc.setVirtualCols(newVirtualCols);
scanOp.setNeededColumnIDs(needed_columns);
scanOp.setNeededColumns(neededColumnNames);
return null;
}