You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2014/10/22 21:37:21 UTC

svn commit: r1633692 - /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java

Author: sershe
Date: Wed Oct 22 19:37:21 2014
New Revision: 1633692

URL: http://svn.apache.org/r1633692
Log:
HIVE-8551 : NPE in FunctionRegistry (affects CBO in negative tests) (Sergey Shelukhin, reviewed by Ashutosh Chauhan)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java?rev=1633692&r1=1633691&r2=1633692&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java Wed Oct 22 19:37:21 2014
@@ -1992,17 +1992,18 @@ public final class FunctionRegistry {
    * @return true if function is a UDAF, has WindowFunctionDescription annotation and the annotations
    *         confirms a ranking function, false otherwise
    */
-  public static boolean isRankingFunction(String name){
+  public static boolean isRankingFunction(String name) {
     FunctionInfo info = getFunctionInfo(name);
+    if (info == null) {
+      return false;
+    }
     GenericUDAFResolver res = info.getGenericUDAFResolver();
-    if (res != null){
-      WindowFunctionDescription desc =
-          AnnotationUtils.getAnnotation(res.getClass(), WindowFunctionDescription.class);
-      if (desc != null){
-        return desc.rankingFunction();
-      }
+    if (res == null) {
+      return false;
     }
-    return false;
+    WindowFunctionDescription desc =
+        AnnotationUtils.getAnnotation(res.getClass(), WindowFunctionDescription.class);
+    return (desc != null) && desc.rankingFunction();
   }
 
   /**