protected static <T> T getSingleParent(Operator<?> operator, Class<T> type)
      throws SemanticException {
    Operator<?> parent = getSingleParent(operator);
    return type.isInstance(parent) ? (T)parent : null;
  }
@param operator the input operator
@param throwException if throw a exception when the input operator has multiple children
@return the single child or null when the input operator has multiple children and
        throwException is false;
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/optimizer/correlation/CorrelationUtilities.java