hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r1467874 - in /hive/trunk/hbase-handler/src: java/org/apache/hadoop/hive/hbase/LazyHBaseRow.java test/org/apache/hadoop/hive/hbase/TestLazyHBaseObject.java
Date Mon, 15 Apr 2013 07:09:21 GMT
Author: navis
Date: Mon Apr 15 07:09:21 2013
New Revision: 1467874

URL: http://svn.apache.org/r1467874
Log:
HIVE-3179 HBase Handler doesn't handle NULLs properly (Lars Francke via Navis)

Modified:
    hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/LazyHBaseRow.java
    hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/TestLazyHBaseObject.java

Modified: hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/LazyHBaseRow.java
URL: http://svn.apache.org/viewvc/hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/LazyHBaseRow.java?rev=1467874&r1=1467873&r2=1467874&view=diff
==============================================================================
--- hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/LazyHBaseRow.java (original)
+++ hive/trunk/hbase-handler/src/java/org/apache/hadoop/hive/hbase/LazyHBaseRow.java Mon Apr
15 07:09:21 2013
@@ -133,7 +133,6 @@ public class LazyHBaseRow extends LazySt
     boolean [] fieldsInited = getFieldInited();
 
     if (!fieldsInited[fieldID]) {
-      fieldsInited[fieldID] = true;
       ByteArrayRef ref = null;
       ColumnMapping colMap = columnsMapping.get(fieldID);
 
@@ -164,6 +163,9 @@ public class LazyHBaseRow extends LazySt
       }
     }
 
+    // Has to be set last because of HIVE-3179: NULL fields would not work otherwise
+    fieldsInited[fieldID] = true;
+
     return fields[fieldID].getObject();
   }
 

Modified: hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/TestLazyHBaseObject.java
URL: http://svn.apache.org/viewvc/hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/TestLazyHBaseObject.java?rev=1467874&r1=1467873&r2=1467874&view=diff
==============================================================================
--- hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/TestLazyHBaseObject.java
(original)
+++ hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/TestLazyHBaseObject.java
Mon Apr 15 07:09:21 2013
@@ -546,6 +546,12 @@ public class TestLazyHBaseObject extends
         + "'c':null,'d':'no'}").replace("'", "\""),
       SerDeUtils.getJSONString(o, oi));
 
+    // This is intentionally duplicated because of HIVE-3179
+    assertEquals(
+      ("{'key':'test-row','a':null,'b':['','a','',''],"
+       + "'c':null,'d':'no'}").replace("'", "\""),
+      SerDeUtils.getJSONString(o, oi));
+
     kvs.clear();
     kvs.add(new KeyValue(Bytes.toBytes("test-row"),
         Bytes.toBytes("cfa"), Bytes.toBytes("a"), Bytes.toBytes("123")));



Mime
View raw message