pitrou commented on code in PR #35628:
URL: https://github.com/apache/arrow/pull/35628#discussion_r1231478575
##########
cpp/src/arrow/array/validate.cc:
##########
@@ -595,6 +614,61 @@ struct ValidateArrayImpl {
return Status::OK();
}
+ Status ValidateBinaryView(const BinaryViewType& type) {
+ int64_t headers_byte_size = data.buffers[1]->size();
+ int64_t required_headers = data.length + data.offset;
+ if (static_cast<int64_t>(headers_byte_size / sizeof(StringHeader)) <
+ required_headers) {
+ return Status::Invalid("Header buffer size (bytes): ", headers_byte_size,
+ " isn't large enough for length: ", data.length,
+ " and offset: ", data.offset);
+ }
+
Review Comment:
Because it's not an error if a buffer is larger than needed. This allows
slicing arrays quickly without having to slice their buffers individually.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]