public static boolean isRankingFunction(String name) throws SemanticException {
    FunctionInfo info = getFunctionInfo(name);
    if (info == null) {
      return false;
    }
    GenericUDAFResolver res = info.getGenericUDAFResolver();
    if (res == null) {
      return false;
    }
    WindowFunctionDescription desc =
        AnnotationUtils.getAnnotation(res.getClass(), WindowFunctionDescription.class);
    return (desc != null) && desc.rankingFunction();
  }
Use this to check if function is ranking function

@param name
         name of a function
@return true if function is a UDAF, has WindowFunctionDescription annotation and the annotations
        confirms a ranking function, false otherwise
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java