hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1454454 - /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java
Date Fri, 08 Mar 2013 16:43:23 GMT
Author: hashutosh
Date: Fri Mar  8 16:43:23 2013
New Revision: 1454454

URL: http://svn.apache.org/r1454454
Log:
HIVE-4098 : OrcInputFormat assumes Hive always calls createValue (Owen Omalley via Ashutosh
Chauhan)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.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=1454454&r1=1454453&r2=1454454&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:43:23 2013
@@ -48,36 +48,32 @@ public class OrcInputFormat  extends Fil
     private final org.apache.hadoop.hive.ql.io.orc.RecordReader reader;
     private final long offset;
     private final long length;
-    private final OrcStruct row;
-    private boolean firstRow = true;
+    private final int numColumns;
     private float progress = 0.0f;
 
     OrcRecordReader(Reader file, Configuration conf,
                     long offset, long length) throws IOException {
       this.reader = file.rows(offset, length,
           findIncludedColumns(file.getTypes(), conf));
-      this.offset = offset;
-      this.length = length;
-      if (reader.hasNext()) {
-        row = (OrcStruct) reader.next(null);
+      List<OrcProto.Type> types = file.getTypes();
+      if (types.size() == 0) {
+        numColumns = 0;
       } else {
-        row = null;
+        numColumns = types.get(0).getSubtypesCount();
       }
+      this.offset = offset;
+      this.length = length;
     }
 
     @Override
     public boolean next(NullWritable key, OrcStruct value) throws IOException {
-      if (firstRow) {
-        firstRow = false;
-        assert value == row: "User didn't pass our value back " + value;
-        return row != null;
-      } else if (reader.hasNext()) {
-        Object obj = reader.next(value);
+      if (reader.hasNext()) {
+        reader.next(value);
         progress = reader.getProgress();
-        assert obj == value : "Reader returned different object " + obj;
         return true;
+      } else {
+        return false;
       }
-      return false;
     }
 
     @Override
@@ -87,7 +83,7 @@ public class OrcInputFormat  extends Fil
 
     @Override
     public OrcStruct createValue() {
-      return row;
+      return new OrcStruct(numColumns);
     }
 
     @Override



Mime
View raw message