pitrou commented on code in PR #50166:
URL: https://github.com/apache/arrow/pull/50166#discussion_r3497207828
##########
dev/archery/archery/integration/datagen.py:
##########
@@ -671,6 +677,13 @@ def _get_type(self):
return OrderedDict([('name', 'binaryview')])
+class InlineBinaryViewField(BinaryViewField):
+ # Generate only inline values, leaving no variadic data buffers.
+
+ def _random_sizes(self, size):
+ return np.arange(size, dtype=np.int32) % (BINARY_VIEW_INLINE_SIZE + 1)
Review Comment:
Why not use
https://numpy.org/doc/stable/reference/random/generated/numpy.random.random_integers.html
?
##########
dev/archery/archery/integration/datagen.py:
##########
@@ -671,6 +677,13 @@ def _get_type(self):
return OrderedDict([('name', 'binaryview')])
+class InlineBinaryViewField(BinaryViewField):
+ # Generate only inline values, leaving no variadic data buffers.
+
+ def _random_sizes(self, size):
+ return np.arange(size, dtype=np.int32) % (BINARY_VIEW_INLINE_SIZE + 1)
Review Comment:
Why not use
https://numpy.org/doc/stable/reference/random/generated/numpy.random.random_integers.html
?
##########
cpp/src/arrow/c/bridge.cc:
##########
@@ -608,7 +608,8 @@ struct ArrayExporter {
export_.variadic_buffer_sizes_.resize(variadic_buffers.size());
size_t i = 0;
for (const auto& buf : variadic_buffers) {
- export_.variadic_buffer_sizes_[i++] = buf->size();
+ // The C Data Interface allows null variadic buffer pointers with size
0.
Review Comment:
But they are invalid in Arrow C++, so we can revert this change, or
explicitly raise an error if we want to avoid a segfault.
(sorry, I think I said something different about this earlier; but I don't
think it makes sense to explicitly allow exporting data that is invalid)
--
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]