From commits-return-1350-archive-asf-public=cust-asf.ponee.io@parquet.apache.org Thu Jun 28 17:27:46 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4E1DD180662 for ; Thu, 28 Jun 2018 17:27:46 +0200 (CEST) Received: (qmail 21874 invoked by uid 500); 28 Jun 2018 15:27:45 -0000 Mailing-List: contact commits-help@parquet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@parquet.apache.org Delivered-To: mailing list commits@parquet.apache.org Received: (qmail 21864 invoked by uid 99); 28 Jun 2018 15:27:45 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2018 15:27:45 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id BC4468508A; Thu, 28 Jun 2018 15:27:44 +0000 (UTC) Date: Thu, 28 Jun 2018 15:27:44 +0000 To: "commits@parquet.apache.org" Subject: [parquet-cpp] branch master updated: PARQUET-1333: [C++] Reading of files with dictionary size 0 fails on Windows with bad_alloc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <153019966468.20929.5536912674832189003@gitbox.apache.org> From: mdeepak@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: parquet-cpp X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: ac5bd8247f6adf8a674a52938c172ab72d1450b2 X-Git-Newrev: d9c262a00f512699b64472cf58ecff7642853efc X-Git-Rev: d9c262a00f512699b64472cf58ecff7642853efc X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. mdeepak pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/parquet-cpp.git The following commit(s) were added to refs/heads/master by this push: new d9c262a PARQUET-1333: [C++] Reading of files with dictionary size 0 fails on Windows with bad_alloc d9c262a is described below commit d9c262a00f512699b64472cf58ecff7642853efc Author: Philipp Hoch AuthorDate: Thu Jun 28 11:27:39 2018 -0400 PARQUET-1333: [C++] Reading of files with dictionary size 0 fails on Windows with bad_alloc The call with size 0 ends up in arrows memory_pool, https://github.com/apache/arrow/blob/884474ca5ca1b8da55c0b23eb7cb784c2cd9bdb4/cpp/src/arrow/memory_pool.cc#L50, and the according allocation fails. See according documentation, https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/aligned-malloc. Only happens on Windows environment, as posix_memalign seems to handle 0 inputs in unix environments. Author: Philipp Hoch Closes #472 from philhoch/bugfix-cover-empty-dicitionary-size-on-windows and squashes the following commits: 0be10bc [Philipp Hoch] account for total_size being 0, as _alligned_malloc with size 0 raises error on Windows environment --- src/parquet/encoding-internal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/parquet/encoding-internal.h b/src/parquet/encoding-internal.h index 894410f..e22edd0 100644 --- a/src/parquet/encoding-internal.h +++ b/src/parquet/encoding-internal.h @@ -398,9 +398,11 @@ inline void DictionaryDecoder::SetDict( for (int i = 0; i < num_dictionary_values; ++i) { total_size += dictionary_[i].len; } - PARQUET_THROW_NOT_OK(byte_array_data_->Resize(total_size, false)); - int offset = 0; + if (total_size > 0) { + PARQUET_THROW_NOT_OK(byte_array_data_->Resize(total_size, false)); + } + int offset = 0; uint8_t* bytes_data = byte_array_data_->mutable_data(); for (int i = 0; i < num_dictionary_values; ++i) { memcpy(bytes_data + offset, dictionary_[i].ptr, dictionary_[i].len);