private static ListMultimap<String, TableScanOperator> splitTableScanOpsByTable(
          ParseContext pctx) {
    ListMultimap<String, TableScanOperator> tableNameToOps = ArrayListMultimap.create();
    // Sort by operator ID so we get deterministic results
    TSComparator comparator = new TSComparator();
    Queue<TableScanOperator> sortedTopOps = new PriorityQueue<>(comparator);
    sortedTopOps.addAll(pctx.getTopOps().values());
    for (TableScanOperator tsOp : sortedTopOps) {
      tableNameToOps.put(tsOp.getTableName().toString(), tsOp);
    }
    return tableNameToOps;
  }
Orders TS operators in decreasing order by "weight".
ql/src/java/org/apache/hadoop/hive/ql/optimizer/SharedWorkOptimizer.java