hadoop-hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r933381 - in /hadoop/hive/trunk: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDTFExplode.java ql/src/test/queries/clientpositive/explode_null.q ql/src/test/results/clientpositive/explode_null.q.out
Date Mon, 12 Apr 2010 19:44:18 GMT
Author: namit
Date: Mon Apr 12 19:44:18 2010
New Revision: 933381

URL: http://svn.apache.org/viewvc?rev=933381&view=rev
Log:
HIVE-1011. GenericUDTFExplode() throws NPE when given nulls
(Paul Yang via namit)


Added:
    hadoop/hive/trunk/ql/src/test/queries/clientpositive/explode_null.q
    hadoop/hive/trunk/ql/src/test/results/clientpositive/explode_null.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDTFExplode.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=933381&r1=933380&r2=933381&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Mon Apr 12 19:44:18 2010
@@ -348,6 +348,9 @@ Trunk -  Unreleased
     HIVE-1280. Add option to CombineHiveInputFormat for non-splittable inputs.
     (Namit Jain via zshao)
 
+    HIVE-1011. GenericUDTFExplode() throws NPE when given nulls
+    (Paul Yang via namit)
+
 Release 0.5.0 -  Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDTFExplode.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDTFExplode.java?rev=933381&r1=933380&r2=933381&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDTFExplode.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDTFExplode.java
Mon Apr 12 19:44:18 2010
@@ -62,12 +62,14 @@ public class GenericUDTFExplode extends 
         fieldOIs);
   }
 
-  private Object[] forwardObj = new Object[1];
+  private final Object[] forwardObj = new Object[1];
 
   @Override
   public void process(Object[] o) throws HiveException {
-
     List<?> list = listOI.getList(o[0]);
+    if(list == null) {
+      return;
+    }
     for (Object r : list) {
       forwardObj[0] = r;
       forward(forwardObj);

Added: hadoop/hive/trunk/ql/src/test/queries/clientpositive/explode_null.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientpositive/explode_null.q?rev=933381&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientpositive/explode_null.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientpositive/explode_null.q Mon Apr 12 19:44:18
2010
@@ -0,0 +1,5 @@
+SELECT explode(col) AS myCol FROM 
+    (SELECT array(1,2,3) AS col FROM src LIMIT 1 
+     UNION ALL
+     SELECT IF(false, array(1,2,3), NULL) AS col FROM src LIMIT 1) a;
+     
\ No newline at end of file

Added: hadoop/hive/trunk/ql/src/test/results/clientpositive/explode_null.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/explode_null.q.out?rev=933381&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/explode_null.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/explode_null.q.out Mon Apr 12 19:44:18
2010
@@ -0,0 +1,17 @@
+PREHOOK: query: SELECT explode(col) AS myCol FROM 
+    (SELECT array(1,2,3) AS col FROM src LIMIT 1 
+     UNION ALL
+     SELECT IF(false, array(1,2,3), NULL) AS col FROM src LIMIT 1) a
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: file:/data/users/pyang/task2/trunk/VENDOR.hive/trunk/build/ql/scratchdir/hive_2010-04-08_15-57-57_440_1997210643218047348/10000
+POSTHOOK: query: SELECT explode(col) AS myCol FROM 
+    (SELECT array(1,2,3) AS col FROM src LIMIT 1 
+     UNION ALL
+     SELECT IF(false, array(1,2,3), NULL) AS col FROM src LIMIT 1) a
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: file:/data/users/pyang/task2/trunk/VENDOR.hive/trunk/build/ql/scratchdir/hive_2010-04-08_15-57-57_440_1997210643218047348/10000
+1
+2
+3



Mime
View raw message