You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jx...@apache.org on 2015/11/06 18:33:04 UTC
[22/55] [abbrv] hive git commit: HIVE-12202 NPE thrown when reading
legacy ACID delta files(Elliot West via Eugene Koifman)
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/02629e97
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/02629e97
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/02629e97
Branch: refs/heads/master-fixed
Commit: 02629e9794e228dcaa8d446423a256d75f71d6dd
Parents: 47617d3
Author: Eugene Koifman <ek...@hortonworks.com>
Authored: Tue Nov 3 09:06:19 2015 -0800
Committer: Eugene Koifman <ek...@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/02629e97/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());
}