Skip to content

Commit

Permalink
Implement ReserveData(int64_t) method for BinaryBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
xuepanchen authored Jan 16, 2018
1 parent e0434e6 commit de318f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cpp/src/arrow/builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1222,10 +1222,14 @@ Status BinaryBuilder::Init(int64_t elements) {
Status BinaryBuilder::Resize(int64_t capacity) {
DCHECK_LT(capacity, std::numeric_limits<int32_t>::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<int32_t>::max());
return value_data_builder_.Resize(capacity * sizeof(int64_t));
}

Status BinaryBuilder::AppendNextOffset() {
const int64_t num_bytes = value_data_builder_.length();
Expand Down

0 comments on commit de318f4

Please sign in to comment.