private static List<Operator<?>> compareAndGatherOps(ParseContext pctx,
      SharedWorkOptimizerCache optimizerCache, Operator<?> op1, Operator<?> op2) throws SemanticException {
    List<Operator<?>> result = new ArrayList<>();
    boolean mergeable = compareAndGatherOps(pctx, optimizerCache, op1, op2, result, true);
    if (!mergeable) {
      return null;
    }
    return result;
  }
Orders TS operators in decreasing order by "weight".
ql/src/java/org/apache/hadoop/hive/ql/optimizer/SharedWorkOptimizer.java