gitedmond commented on code in PR #52286:
URL: https://github.com/apache/arrow/pull/52286#discussion_r4218839888
##########
ruby/red-arrow/ext/arrow/memory-view.cpp:
##########
@@ -205,11 +206,13 @@ namespace red_arrow {
private:
void fill(const arrow::Array& array) {
const auto array_data = array.data();
- const auto data = array_data->GetValuesSafe<uint8_t>(1);
- view_->data = const_cast<void *>(reinterpret_cast<const void *>(data));
const auto type =
std::static_pointer_cast<const arrow::FixedWidthType>(array.type());
view_->item_size = type->bit_width() / 8;
+ const auto byte_offset =
+ array_data->offset * std::max<int64_t>(view_->item_size, 1);
Review Comment:
Removed `std::max`. The byte offset now uses the type’s bit width, and
Boolean slices with `offset % 8 != 0` are rejected. Added separate tests for
byte-aligned export and non-byte-aligned rejection.
--
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]