hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gunt...@apache.org
Subject svn commit: r1582616 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/io/orc/OrcStruct.java test/queries/clientpositive/orc_diff_part_cols2.q test/results/clientpositive/orc_diff_part_cols2.q.out
Date Fri, 28 Mar 2014 06:02:03 GMT
Author: gunther
Date: Fri Mar 28 06:02:03 2014
New Revision: 1582616

URL: http://svn.apache.org/r1582616
Log:
HIVE-4975: Reading orc file throws exception after adding new column (Kevin Wilfong via Gunther
Hagleitner)

Added:
    hive/trunk/ql/src/test/queries/clientpositive/orc_diff_part_cols2.q
    hive/trunk/ql/src/test/results/clientpositive/orc_diff_part_cols2.q.out
Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcStruct.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcStruct.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcStruct.java?rev=1582616&r1=1582615&r2=1582616&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcStruct.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcStruct.java Fri Mar 28 06:02:03
2014
@@ -223,7 +223,13 @@ final public class OrcStruct implements 
       if (object == null) {
         return null;
       }
-      return ((OrcStruct) object).fields[((Field) field).offset];
+      int offset = ((Field) field).offset;
+      OrcStruct struct = (OrcStruct) object;
+      if (offset >= struct.fields.length) {
+        return null;
+      }
+
+      return struct.fields[offset];
     }
 
     @Override

Added: hive/trunk/ql/src/test/queries/clientpositive/orc_diff_part_cols2.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/orc_diff_part_cols2.q?rev=1582616&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/orc_diff_part_cols2.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/orc_diff_part_cols2.q Fri Mar 28 06:02:03
2014
@@ -0,0 +1,11 @@
+-- Create a table with one column, write to it, then add an additional column
+-- This can break reads
+
+CREATE TABLE test_orc (key STRING)
+STORED AS ORC;
+
+INSERT OVERWRITE TABLE test_orc SELECT key FROM src LIMIT 5;
+
+ALTER TABLE test_orc ADD COLUMNS (value STRING);
+
+SELECT * FROM test_orc order by key;

Added: hive/trunk/ql/src/test/results/clientpositive/orc_diff_part_cols2.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/orc_diff_part_cols2.q.out?rev=1582616&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/orc_diff_part_cols2.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/orc_diff_part_cols2.q.out Fri Mar 28 06:02:03
2014
@@ -0,0 +1,47 @@
+PREHOOK: query: -- Create a table with one column, write to it, then add an additional column
+-- This can break reads
+
+CREATE TABLE test_orc (key STRING)
+STORED AS ORC
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+POSTHOOK: query: -- Create a table with one column, write to it, then add an additional column
+-- This can break reads
+
+CREATE TABLE test_orc (key STRING)
+STORED AS ORC
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@test_orc
+PREHOOK: query: INSERT OVERWRITE TABLE test_orc SELECT key FROM src LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: default@test_orc
+POSTHOOK: query: INSERT OVERWRITE TABLE test_orc SELECT key FROM src LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: default@test_orc
+POSTHOOK: Lineage: test_orc.key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default),
]
+PREHOOK: query: ALTER TABLE test_orc ADD COLUMNS (value STRING)
+PREHOOK: type: ALTERTABLE_ADDCOLS
+PREHOOK: Input: default@test_orc
+PREHOOK: Output: default@test_orc
+POSTHOOK: query: ALTER TABLE test_orc ADD COLUMNS (value STRING)
+POSTHOOK: type: ALTERTABLE_ADDCOLS
+POSTHOOK: Input: default@test_orc
+POSTHOOK: Output: default@test_orc
+POSTHOOK: Lineage: test_orc.key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default),
]
+PREHOOK: query: SELECT * FROM test_orc order by key
+PREHOOK: type: QUERY
+PREHOOK: Input: default@test_orc
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM test_orc order by key
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@test_orc
+#### A masked pattern was here ####
+POSTHOOK: Lineage: test_orc.key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default),
]
+165	NULL
+238	NULL
+27	NULL
+311	NULL
+86	NULL



Mime
View raw message