You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2013/03/08 17:38:22 UTC

svn commit: r1454453 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java

Author: hashutosh
Date: Fri Mar  8 16:38:21 2013
New Revision: 1454453

URL: http://svn.apache.org/r1454453
Log:
HIVE-4097 : ORC file doesnt properly interpret empty hive.io.file.readcolumn.ids (Owen Omalley via Ashutosh Chauhan)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java?rev=1454453&r1=1454452&r2=1454453&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java Fri Mar  8 16:38:21 2013
@@ -138,7 +138,7 @@ public class OrcInputFormat  extends Fil
                                                Configuration conf) {
     String includedStr =
         conf.get(ColumnProjectionUtils.READ_COLUMN_IDS_CONF_STR);
-    if (includedStr == null) {
+    if (includedStr == null || includedStr.trim().length() == 0) {
       return null;
     } else {
       int numColumns = types.size();

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java?rev=1454453&r1=1454452&r2=1454453&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java Fri Mar  8 16:38:21 2013
@@ -169,6 +169,22 @@ public class TestInputOutputFormat {
     }
     assertEquals(3, rowNum);
     reader.close();
+
+    // test the mapping of empty string to all columns
+    conf.set("hive.io.file.readcolumn.ids", "");
+    reader = in.getRecordReader(splits[0], conf, Reporter.NULL);
+    key = reader.createKey();
+    value = (Writable) reader.createValue();
+    rowNum = 0;
+    fields = inspector.getAllStructFieldRefs();
+    while (reader.next(key, value)) {
+      assertEquals(++rowNum, intInspector.get(inspector.
+          getStructFieldData(value, fields.get(0))));
+      assertEquals(2, intInspector.get(inspector.
+          getStructFieldData(serde.deserialize(value), fields.get(1))));
+    }
+    assertEquals(3, rowNum);
+    reader.close();
   }
 
   static class NestedRow implements Writable {