public static <T> Set<T> findOperatorsUpstream(Collection<Operator<?>> starts, Class<T> clazz) {
    Set<T> found = new HashSet<T>();
    for (Operator<?> start : starts) {
      findOperatorsUpstream(start, clazz, found);
    }
    return found;
  }
Return the ancestor of the specified operator at the provided path or null if the path is invalid.

The method is equivalent to following code:
<pre>{@code
    op.getParentOperators().get(path[0])
    .getParentOperators().get(path[1])
    ...
    .getParentOperators().get(path[n])
}</pre>
with additional checks about the validity of the provided path and the type of the ancestor.

@param op the operator for which we
@param clazz the class of the ancestor operator
@param path the path leading to the desired ancestor
@param <T> the type of the ancestor
@return the ancestor of the specified operator at the provided path or null if the path is invalid.
ql/src/java/org/apache/hadoop/hive/ql/exec/OperatorUtils.java