@Override
  public ParseContext transform(ParseContext pctx) throws SemanticException {
    OperatorGraph og = new OperatorGraph(pctx);
    try (AutoCloseable ac = new MaterializeSemiJoinEdges(pctx)) {
      fixParallelEdges(og);
    } catch (Exception e) {
      if (e instanceof SemanticException) {
        throw (SemanticException) e;
      }
      throw new SemanticException(e);

    }
    return pctx;
  }
Inserts an extra RS to avoid parallel edges.

For mapjoins, semijoins its less costly to sometimes reshuffle the existing data - than computing it from scratch.
Parallel edges are introduced by the {@link SharedWorkOptimizer} in case this fixer could patch them up.

+--------------------+           +--------------------+
|                    |           |                    |
|   [...]    [...]   |           |   [...]    [...]   |
|     |        |     |           |     |        |     |
|  +-----+  +-----+  |           |  +-----+  +-----+  |
|  |RS_1 |  |RS_2 |  |           |  |RS_1 |  |RS_2 |  |
|  +-----+  +-----+  |           |  +-----+  +-----+  |
|     |        |     |           |     |        |     |
+---- | ------ | ----+           +---- | ------ | ----+
      |        |                       |        |
      |        |                       |   +--- | ---+
      |        |                       |   | +-----+ |
      |        |         $gt;          |   | |RS_T | |
      |        |                       |   | +-----+ |
      |        |                       |   +--- | ---+
      |        |                       |        |
+---- | ------ | ----+           +---- | ------ | ----+
|  +-----+  +-----+  |           |  +-----+  +-----+  |
|  |OP_1 |  |OP_2 |  |           |  |OP_1 |  |OP_2 |  |
|  +-----+  +-----+  |           |  +-----+  +-----+  |
|     |        |     |           |     |        |     |
|   [...]    [...]   |           |   [...]    [...]   |
|                    |           |                    |
+--------------------+           +--------------------+
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ParallelEdgeFixer.java