protected void mergeSchema(TableScanOperator discardableTsOp, TableScanOperator retainableTsOp) {
    for (int colId : discardableTsOp.getConf().getNeededColumnIDs()) {
      if (!retainableTsOp.getConf().getNeededColumnIDs().contains(colId)) {
        retainableTsOp.getConf().getNeededColumnIDs().add(colId);
      }
    }
    for (String col : discardableTsOp.getConf().getNeededColumns()) {
      if (!retainableTsOp.getConf().getNeededColumns().contains(col)) {
        retainableTsOp.getConf().getNeededColumns().add(col);
      }
    }
    for (VirtualColumn col : discardableTsOp.getConf().getVirtualCols()) {
      if (!retainableTsOp.getConf().getVirtualCols().contains(col)) {
        retainableTsOp.getConf().getVirtualCols().add(col);
      }
    }
  }
Class wrapping shared work optimizer.
This implementation enables merging of TS with different schemas by taking the union of the
{@link TableScanDesc#getNeededColumns()} and {@link TableScanDesc#getNeededColumnIDs()}
from both {@link TableScanOperator}s.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/SharedWorkOptimizer.java