From 232024e38ba8b73c56a2d804afb8923e43a4cd84 Mon Sep 17 00:00:00 2001 From: Panchen Xue Date: Mon, 15 Jan 2018 14:16:43 -0500 Subject: [PATCH] Update BinaryBuilder::Resize(int64_t capacity) in builder.cc When building BinaryArrays with a known size using Resize and Reserve methods, space is also reserved for value_data_builder_ to prevent internal reallocation --- cpp/src/arrow/builder.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/src/arrow/builder.cc b/cpp/src/arrow/builder.cc index de132b5f6a0d1..51b94374c85fc 100644 --- a/cpp/src/arrow/builder.cc +++ b/cpp/src/arrow/builder.cc @@ -1223,6 +1223,7 @@ Status BinaryBuilder::Resize(int64_t capacity) { DCHECK_LT(capacity, std::numeric_limits::max()); // one more then requested for offsets RETURN_NOT_OK(offsets_builder_.Resize((capacity + 1) * sizeof(int64_t))); + RETURN_NOT_OK(value_data_builder_.Resize(capacity)); return ArrayBuilder::Resize(capacity); }