@Override
            public int compare(MapJoinOperator mj1, MapJoinOperator mj2) {
              if (mj1 == null || mj2 == null) {
                throw new NullPointerException();
              }

              int res = Long.compare(sizes.get(mj1), sizes.get(mj2));
              if (res == 0) {
                res = Integer.compare(positions.get(mj1), positions.get(mj2));
              }
              return res;
            }
MemoryDecider is a simple physical optimizer that adjusts the memory layout of tez tasks.
Currently it only cares about hash table sizes for the graceful hash join.
It tried to keep hashtables that are small and early in the operator pipeline completely
in memory.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/MemoryDecider.java