public static Operator<?> getSameVertexParent(Operator<?> current, Operator<?> terminal) {
    if (current == terminal) {
      return null;
    }
    List<Operator<?>> parents = current.getParentOperators();
    if (parents == null || parents.isEmpty()) {
      return null;
    }
    if (parents.size() == 1) {
      return parents.get(0);
    }
    if (terminal != null && parents.contains(terminal)) {
      return terminal;
    }
    // When multi-parent, backtrack to non-RS parent branches looking for the src Expr
    return parents.stream().filter(op -> !(op instanceof ReduceSinkOperator)).findFirst().get();
  }
When Multi-Parent backtrack to the same Vertex (non-RS) branch and return the found parent.
@param current Parent OP
@param terminal End Op
@return parent Op or Null when not found
ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java