@Override
    public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx,
        Object... nodeOutputs) throws SemanticException {
      AbstractMapJoinOperator<MapJoinDesc> mapJoin = (AbstractMapJoinOperator<MapJoinDesc>) nd;
      GenMRProcContext ctx = (GenMRProcContext) procCtx;

      // find the branch on which this processor was invoked
      int pos = getPositionParent(mapJoin, stack);

      Map<Operator<? extends OperatorDesc>, GenMapRedCtx> mapCurrCtx = ctx
          .getMapCurrCtx();
      GenMapRedCtx mapredCtx = mapCurrCtx.get(mapJoin.getParentOperators().get(pos));
      Task<?> currTask = mapredCtx.getCurrTask();
      MapredWork currPlan = (MapredWork) currTask.getWork();
      String currAliasId = mapredCtx.getCurrAliasId();
      HashMap<Operator<? extends OperatorDesc>, Task<?>> opTaskMap =
          ctx.getOpTaskMap();
      Task<?> oldTask = opTaskMap.get(mapJoin);

      ctx.setCurrAliasId(currAliasId);
      ctx.setCurrTask(currTask);

      // If we are seeing this mapjoin for the first time, initialize the plan.
      // If we are seeing this mapjoin for the second or later time then atleast one of the
      // branches for this mapjoin have been encounered. Join the plan with the plan created
      // the first time.
      boolean local = pos != mapJoin.getConf().getPosBigTable();
      if (oldTask == null) {
        assert currPlan.getReduceWork() == null;
        initMapJoinPlan(mapJoin, currTask, ctx, local);
      } else {
        // The current plan can be thrown away after being merged with the
        // original plan
        joinMapJoinPlan(oldTask, ctx, local);
        ctx.setCurrTask(currTask = oldTask);
      }
      MapredWork plan = (MapredWork) currTask.getWork();
      setupBucketMapJoinInfo(plan.getMapWork(), mapJoin);

      mapCurrCtx.put(mapJoin, new GenMapRedCtx(ctx.getCurrTask(), ctx.getCurrAliasId()));

      // local aliases need not to hand over context further
      return !local;
    }
Merge the current task with the task for the current mapjoin. The mapjoin operator
has already been encountered.

@param op
         operator being processed
@param oldTask
         the old task for the current mapjoin
@param opProcCtx
         processing context
@param pos
         position of the parent in the stack
ql/src/java/org/apache/hadoop/hive/ql/optimizer/MapJoinFactory.java