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:38:49 UTC
svn commit: r1633694 -
/hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
Author: sershe
Date: Wed Oct 22 19:38:48 2014
New Revision: 1633694
URL: http://svn.apache.org/r1633694
Log:
HIVE-8551 : NPE in FunctionRegistry (affects CBO in negative tests) (Sergey Shelukhin, reviewed by Ashutosh Chauhan)
Modified:
hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
Modified: hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java?rev=1633694&r1=1633693&r2=1633694&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java (original)
+++ hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java Wed Oct 22 19:38:48 2014
@@ -1964,17 +1964,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();
}
/**