diff --git a/cpp/src/arrow/array/validate.cc b/cpp/src/arrow/array/validate.cc index 6ac885f8443c6..cfbabfaeef0d5 100644 --- a/cpp/src/arrow/array/validate.cc +++ b/cpp/src/arrow/array/validate.cc @@ -204,7 +204,7 @@ struct ValidateArrayImpl { return Status::Invalid("Negative offsets in binary array"); } const auto data_extent = last_offset - first_offset; - const auto values_length = values.size(); + const auto values_length = values.capacity(); if (values_length < data_extent) { return Status::Invalid("Length spanned by binary offsets (", data_extent, ") larger than values array (size ", values_length, ")"); diff --git a/cpp/src/parquet/column_reader.cc b/cpp/src/parquet/column_reader.cc index f4979d2d97f57..56f87b74569fd 100644 --- a/cpp/src/parquet/column_reader.cc +++ b/cpp/src/parquet/column_reader.cc @@ -1641,7 +1641,7 @@ class ByteArrayChunkedRecordReader : public TypedRecordReader, int64_t binary_length = last_offset - first_offset; // std::cout << "binary_length:" << binary_length << std::endl; values_->SetSize(binary_length); - + offset_ = AllocateBuffer(this->pool_); bianry_length_ = 0; return result;