You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2018/03/27 22:28:34 UTC

hive git commit: HIVE-19056: IllegalArgumentException in FixAcidKeyIndex when ORC file has 0 rows (Jason Dere, reviewed by Eugene Koifman)

Repository: hive
Updated Branches:
  refs/heads/master 245c39b4c -> f82eb8dd4


HIVE-19056: IllegalArgumentException in FixAcidKeyIndex when ORC file has 0 rows (Jason Dere, reviewed by Eugene Koifman)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/f82eb8dd
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f82eb8dd
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f82eb8dd

Branch: refs/heads/master
Commit: f82eb8dd43a7b800962f02f129c5aac5d6b4f119
Parents: 245c39b
Author: Jason Dere <jd...@hortonworks.com>
Authored: Tue Mar 27 15:27:59 2018 -0700
Committer: Jason Dere <jd...@hortonworks.com>
Committed: Tue Mar 27 15:27:59 2018 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hive/ql/io/orc/FixAcidKeyIndex.java | 4 ++++
 .../org/apache/hadoop/hive/ql/io/orc/TestFixAcidKeyIndex.java  | 6 ++++++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/f82eb8dd/ql/src/java/org/apache/hadoop/hive/ql/io/orc/FixAcidKeyIndex.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/FixAcidKeyIndex.java b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/FixAcidKeyIndex.java
index 6920938..8a7437e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/FixAcidKeyIndex.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/FixAcidKeyIndex.java
@@ -108,6 +108,10 @@ public class FixAcidKeyIndex {
   }
 
   static boolean isAcidKeyIndexValid(Reader reader) {
+    if (reader.getNumberOfRows() == 0) {
+      return true;
+    }
+
     // The number of stripes should match the key index count
     List<StripeInformation> stripes = reader.getStripes();
     RecordIdentifier[] keyIndex = OrcRecordUpdater.parseKeyIndex(reader);

http://git-wip-us.apache.org/repos/asf/hive/blob/f82eb8dd/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestFixAcidKeyIndex.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestFixAcidKeyIndex.java b/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestFixAcidKeyIndex.java
index bf478cc..c4d569e 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestFixAcidKeyIndex.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestFixAcidKeyIndex.java
@@ -211,6 +211,12 @@ public class TestFixAcidKeyIndex {
 
   @Test
   public void testValidKeyIndex() throws Exception {
+    // Try with 0 row file.
+    createTestAcidFile(testFilePath, 0, new GoodKeyIndexBuilder());
+    checkValidKeyIndex(testFilePath);
+    // Attempting to fix a valid - should not result in a new file.
+    fixValidIndex(testFilePath);
+
     // Try single stripe
     createTestAcidFile(testFilePath, 100, new GoodKeyIndexBuilder());
     checkValidKeyIndex(testFilePath);