From de318f47e0f0995b425ca298585cbcba0b1ca7f3 Mon Sep 17 00:00:00 2001 From: Panchen Xue Date: Tue, 16 Jan 2018 16:51:29 -0500 Subject: [PATCH] Implement ReserveData(int64_t) method for BinaryBuilder --- cpp/src/arrow/builder.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/builder.cc b/cpp/src/arrow/builder.cc index dac02d14e719b..712e4194526df 100644 --- a/cpp/src/arrow/builder.cc +++ b/cpp/src/arrow/builder.cc @@ -1222,10 +1222,14 @@ Status BinaryBuilder::Init(int64_t elements) { 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 * sizeof(int64_t))); + RETURN_NOT_OK(offsets_builder_.Resize((capacity + 1) * sizeof(int32_t))); return ArrayBuilder::Resize(capacity); } + +Status BinaryBuilder::ReserveData(int64_t capacity) { + DCHECK_LT(capacity, std::numeric_limits::max()); + return value_data_builder_.Resize(capacity * sizeof(int64_t)); +} Status BinaryBuilder::AppendNextOffset() { const int64_t num_bytes = value_data_builder_.length();