hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject [23/50] [abbrv] hive git commit: HIVE-11216: UDF GenericUDFMapKeys throws NPE when a null map value is passed in (Yibing Shi via Chaoyu Tang, reviewed by Szehon Ho
Date Wed, 22 Jul 2015 20:47:51 GMT
HIVE-11216: UDF GenericUDFMapKeys throws NPE when a null map value is passed in (Yibing Shi
via Chaoyu Tang, reviewed by Szehon Ho


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/854950b2
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/854950b2
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/854950b2

Branch: refs/heads/hbase-metastore
Commit: 854950b2a0ce5b3885b2be0e7359f04b483f687c
Parents: e74dc32
Author: ctang <ctang.ma@gmail.com>
Authored: Thu Jul 16 14:34:28 2015 -0400
Committer: ctang <ctang.ma@gmail.com>
Committed: Thu Jul 16 14:34:28 2015 -0400

----------------------------------------------------------------------
 .../apache/hadoop/hive/ql/udf/generic/GenericUDFMapKeys.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/854950b2/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMapKeys.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMapKeys.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMapKeys.java
index d8afd74..d0cff08 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMapKeys.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMapKeys.java
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hive.ql.udf.generic;
 
 import java.util.ArrayList;
+import java.util.Map;
 
 import org.apache.hadoop.hive.ql.exec.Description;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
@@ -61,7 +62,10 @@ public class GenericUDFMapKeys extends GenericUDF {
   public Object evaluate(DeferredObject[] arguments) throws HiveException {
     retArray.clear();
     Object mapObj = arguments[0].get();
-    retArray.addAll(mapOI.getMap(mapObj).keySet());
+    Map<?,?> mapVal = mapOI.getMap(mapObj);
+    if (mapVal != null) {
+      retArray.addAll(mapVal.keySet());
+    }
     return retArray;
   }
 


Mime
View raw message