pitrou commented on code in PR #46706:
URL: https://github.com/apache/arrow/pull/46706#discussion_r2135249466
##########
cpp/src/arrow/ipc/writer.cc:
##########
@@ -329,15 +329,24 @@ class RecordBatchSerializer {
return Status::OK();
}
- int64_t required_bytes = sizeof(offset_type) * (array.length() + 1);
- if (array.value_offset(0) > 0) {
+ const int64_t required_bytes = sizeof(offset_type) * (array.length() + 1);
+
+ offset_type first_offset = 0;
+ RETURN_NOT_OK(MemoryManager::CopyBufferSliceToCPU(
+ array.data()->buffers[1], array.offset() * sizeof(offset_type),
+ sizeof(offset_type), reinterpret_cast<uint8_t*>(&first_offset)));
+
+ if (first_offset > 0) {
// If the offset of the first value is non-zero, then we must create a
new
// offsets buffer with shifted offsets.
+ if (!array.data()->buffers[1]->is_cpu()) {
+ return Status::NotImplemented("Rebasing non-CPU offsets");
+ }
Review Comment:
1. Yes
2. This codepath is only taken with a non-zero first offset, but the CUDA
tests don't exercise that (otherwise they would have been crashing on git main
too)
--
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]