Skip to content

Commit

Permalink
Update builder.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
xuepanchen committed Jan 17, 2018
1 parent b002e0b commit 8dd5eaa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cpp/src/arrow/builder.cc
Expand Up @@ -1227,8 +1227,11 @@ Status BinaryBuilder::Resize(int64_t 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));
if(value_data_length.length() + capacity > std::numeric_limits<int32_t>::max()) {
return Status::Invalid("Cannot reserve capacity larger than 2^31 - 1 in length for binary data");
}

return value_data_builder_.Resize(value_data_length.length() + capacity);
}

Status BinaryBuilder::AppendNextOffset() {
Expand Down

0 comments on commit 8dd5eaa

Please sign in to comment.