From commits-return-5662-apmail-drill-commits-archive=drill.apache.org@drill.apache.org Fri Mar 30 14:41:15 2018 Return-Path: X-Original-To: apmail-drill-commits-archive@www.apache.org Delivered-To: apmail-drill-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 18E2917B6B for ; Fri, 30 Mar 2018 14:41:15 +0000 (UTC) Received: (qmail 33060 invoked by uid 500); 30 Mar 2018 14:41:15 -0000 Delivered-To: apmail-drill-commits-archive@drill.apache.org Received: (qmail 32941 invoked by uid 500); 30 Mar 2018 14:41:15 -0000 Mailing-List: contact commits-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: commits@drill.apache.org Delivered-To: mailing list commits@drill.apache.org Received: (qmail 32785 invoked by uid 99); 30 Mar 2018 14:41:14 -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; Fri, 30 Mar 2018 14:41:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B42BFF4DFF; Fri, 30 Mar 2018 14:41:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: amansinha@apache.org To: commits@drill.apache.org Date: Fri, 30 Mar 2018 14:41:17 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [4/7] drill git commit: DRILL-6254: IllegalArgumentException: the requested size must be non-negative DRILL-6254: IllegalArgumentException: the requested size must be non-negative close apache/drill#1179 Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/67710bba Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/67710bba Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/67710bba Branch: refs/heads/master Commit: 67710bba7cdbc05428df7390bad8639b099769fc Parents: 7088bfe Author: Padma Penumarthy Authored: Wed Mar 21 13:39:43 2018 -0700 Committer: Aman Sinha Committed: Thu Mar 29 23:21:50 2018 -0700 ---------------------------------------------------------------------- .../drill/exec/physical/impl/flatten/FlattenRecordBatch.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/67710bba/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java index 9dd1770..7509809 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java @@ -237,7 +237,10 @@ public class FlattenRecordBatch extends AbstractSingleRecordBatch { private void handleRemainder() { int remainingRecordCount = flattener.getFlattenField().getAccessor().getInnerValueCount() - remainderIndex; - if (!doAlloc(remainingRecordCount)) { + + // remainingRecordCount can be much higher than number of rows we will have in outgoing batch. + // Do memory allocation only for number of rows we are going to have in the batch. + if (!doAlloc(Math.min(remainingRecordCount, flattenMemoryManager.getOutputRowCount()))) { outOfMemory = true; return; }