hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vik...@apache.org
Subject [2/2] 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, 21 Oct 2015 22:07:34 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/e79f4d42
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/e79f4d42
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/e79f4d42

Branch: refs/heads/branch-1.2
Commit: e79f4d42168a2c4186b25f183afddbec9a12e181
Parents: 46f2e3c
Author: ctang <ctang.ma@gmail.com>
Authored: Thu Jul 16 14:34:28 2015 -0400
Committer: vikram <vikram@hortonworks.com>
Committed: Wed Oct 21 14:30:33 2015 -0700

----------------------------------------------------------------------
 .../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/e79f4d42/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