FAQ
HIVE-12202 NPE thrown when reading legacy ACID delta files(Elliot West via Eugene Koifman)


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

Branch: refs/heads/master
Commit: 89703e7d0f385a5e93208f55703d4cbf85329fef
Parents: 595fa99
Author: Eugene Koifman <ekoifman@hortonworks.com>
Authored: Tue Nov 3 09:06:19 2015 -0800
Committer: Eugene Koifman <ekoifman@hortonworks.com>
Committed: Tue Nov 3 09:06:19 2015 -0800

----------------------------------------------------------------------
  .../org/apache/hadoop/hive/ql/io/AcidInputFormat.java | 14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/89703e7d/ql/src/java/org/apache/hadoop/hive/ql/io/AcidInputFormat.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidInputFormat.java b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidInputFormat.java
index 24506b7..7c7074d 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidInputFormat.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidInputFormat.java
@@ -33,7 +33,6 @@ import java.io.DataInput;
  import java.io.DataOutput;
  import java.io.IOException;
  import java.util.ArrayList;
-import java.util.Collections;
  import java.util.List;

  /**
@@ -115,11 +114,14 @@ public interface AcidInputFormat<KEY extends WritableComparable, VALUE>
      private List<Integer> stmtIds;

      public DeltaMetaData() {
- this(0,0,null);
+ this(0,0,new ArrayList<Integer>());
      }
      DeltaMetaData(long minTxnId, long maxTxnId, List<Integer> stmtIds) {
        this.minTxnId = minTxnId;
        this.maxTxnId = maxTxnId;
+ if (stmtIds == null) {
+ throw new IllegalArgumentException("stmtIds == null");
+ }
        this.stmtIds = stmtIds;
      }
      long getMinTxnId() {
@@ -136,9 +138,6 @@ public interface AcidInputFormat<KEY extends WritableComparable, VALUE>
        out.writeLong(minTxnId);
        out.writeLong(maxTxnId);
        out.writeInt(stmtIds.size());
- if(stmtIds == null) {
- return;
- }
        for(Integer id : stmtIds) {
          out.writeInt(id);
        }
@@ -147,11 +146,8 @@ public interface AcidInputFormat<KEY extends WritableComparable, VALUE>
      public void readFields(DataInput in) throws IOException {
        minTxnId = in.readLong();
        maxTxnId = in.readLong();
+ stmtIds.clear();
        int numStatements = in.readInt();
- if(numStatements <= 0) {
- return;
- }
- stmtIds = new ArrayList<>();
        for(int i = 0; i < numStatements; i++) {
          stmtIds.add(in.readInt());
        }

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 4 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedNov 3, '15 at 5:27p
activeNov 3, '15 at 7:48p
posts4
users1
websitehive.apache.org

1 user in discussion

Ekoifman: 4 posts

People

Translate

site design / logo © 2021 Grokbase