public void finishOuterRepeated(VectorizedRowBatch batch, JoinUtil.JoinResult joinResult,
      VectorMapJoinHashMapResult hashMapResult, boolean someRowsFilteredOut,
      boolean inputSelectedInUse, int inputLogicalSize)
          throws IOException, HiveException {

    // LOG.debug("finishOuterRepeated batch #" + batchCounter + " " + joinResult.name() + " batch.size " + batch.size + " someRowsFilteredOut " + someRowsFilteredOut);

    switch (joinResult) {
    case MATCH:

      // Rows we looked up as one repeated key are a match.  But filtered out rows
      // need to be generated as non-matches, too.

      if (someRowsFilteredOut) {

        // For the filtered out rows that didn't (logically) get looked up in the hash table,
        // we need to generate no match results for those too...

        // Run value expressions over original (whole) input batch.
        doValueExprOnInputSelected(batch, inputSelectedInUse, inputLogicalSize);

        // Now calculate which rows were filtered out (they are logically no matches).

        // Determine which rows are non matches by determining the delta between inputSelected and
        // (current) batch selected.

        int noMatchCount = subtractFromInputSelected(
                inputSelectedInUse, inputLogicalSize, batch.selected, batch.size, noMatchs);

        generateOuterNulls(batch, noMatchs, noMatchCount);

        // Now generate the matchs.  Single small table values will be put into the big table
        // batch and come back in matchs.  Any multiple small table value results will go into
        // the overflow batch.
        generateHashMapResultRepeatedAll(batch, hashMapResult);

        // Merge noMatchs and (match) selected.
        int mergeCount = sortMerge(
                noMatchs, noMatchCount, batch.selected, batch.size, merged);

        System.arraycopy(merged, 0, batch.selected, 0, mergeCount);
        batch.size = mergeCount;
        batch.selectedInUse = true;
      } else {

        // Just run our value expressions over input batch.

        if (bigTableValueExpressions != null) {
          for(VectorExpression ve: bigTableValueExpressions) {
            ve.evaluate(batch);
          }
        }

        generateHashMapResultRepeatedAll(batch, hashMapResult);
      }
      break;

    case SPILL:

      // Rows we looked up as one repeated key need to spill.  But filtered out rows
      // need to be generated as non-matches, too.

      spillBatchRepeated(batch, (VectorMapJoinHashTableResult) hashMapResult);

      // After using selected to generate spills, generate non-matches, if any.
      if (someRowsFilteredOut) {

        // Determine which rows are non matches by determining the delta between inputSelected and
        // (current) batch selected.

        int noMatchCount = subtractFromInputSelected(
                inputSelectedInUse, inputLogicalSize, batch.selected, batch.size, noMatchs);

        System.arraycopy(noMatchs, 0, batch.selected, 0, noMatchCount);
        batch.size = noMatchCount;
        batch.selectedInUse = true;

        generateOuterNullsRepeatedAll(batch);
      } else {
        batch.size = 0;
      }

      break;

    case NOMATCH:

      if (someRowsFilteredOut) {

        // When the repeated no match is due to filtering, we need to restore the
        // selected information.

        if (inputSelectedInUse) {
          System.arraycopy(inputSelected, 0, batch.selected, 0, inputLogicalSize);
        }
        batch.selectedInUse = inputSelectedInUse;
        batch.size = inputLogicalSize;
      }

      // Run our value expressions over whole batch.
      if (bigTableValueExpressions != null) {
        for(VectorExpression ve: bigTableValueExpressions) {
          ve.evaluate(batch);
        }
      }

      generateOuterNullsRepeatedAll(batch);
      break;
    }
  }
Generate the outer join output results for one vectorized row batch with a repeated key.

Any filter expressions will apply now since hash map lookup for outer join is complete.

@param batch
         The big table batch with any matching and any non matching rows both as
         selected in use.
@param joinResult
         The hash map lookup result for the repeated key.
@param hashMapResult
         The array of all hash map results for the batch.
@param someRowsFilteredOut
         Whether some rows of the repeated key batch were knocked out by the filter.
@param inputSelectedInUse
         A copy of the batch's selectedInUse flag on input to the process method.
@param inputLogicalSize
         The batch's size on input to the process method.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/VectorMapJoinOuterGenerateResultOperator.java