Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E719518C76 for ; Tue, 3 Nov 2015 17:27:16 +0000 (UTC) Received: (qmail 89047 invoked by uid 500); 3 Nov 2015 17:27:16 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 88954 invoked by uid 500); 3 Nov 2015 17:27:16 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 88939 invoked by uid 99); 3 Nov 2015 17:27:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Nov 2015 17:27:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 73431E0362; Tue, 3 Nov 2015 17:27:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ekoifman@apache.org To: commits@hive.apache.org Date: Tue, 03 Nov 2015 17:27:17 -0000 Message-Id: In-Reply-To: <6809e26e18aa431e852a7625871cd848@git.apache.org> References: <6809e26e18aa431e852a7625871cd848@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] 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/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 Authored: Tue Nov 3 09:06:19 2015 -0800 Committer: Eugene Koifman 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 private List stmtIds; public DeltaMetaData() { - this(0,0,null); + this(0,0,new ArrayList()); } DeltaMetaData(long minTxnId, long maxTxnId, List 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 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 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()); }