@Override
  public PhysicalContext resolve(PhysicalContext pctx) throws SemanticException {

    pctx.getConf();

    // create dispatcher and graph walker
    SemanticDispatcher disp = new MemoryCalculator(pctx);
    TaskGraphWalker ogw = new TaskGraphWalker(disp);

    // get all the tasks nodes from root task
    ArrayList<Node> topNodes = new ArrayList<Node>();
    topNodes.addAll(pctx.getRootTasks());

    // begin to walk through the task tree.
    ogw.startWalking(topNodes, null);
    return pctx;
  }
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