You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "pitrou (via GitHub)" <gi...@apache.org> on 2023/06/15 19:59:52 UTC

[GitHub] [arrow] pitrou commented on a diff in pull request #35628: GH-35627: [C++][Format][Integration] Add string view to the arrow format

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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org