Jefffrey commented on code in PR #10839:
URL: https://github.com/apache/arrow-rs/pull/10839#discussion_r3860488836
##########
arrow-buffer/src/util/bit_chunk_iterator.rs:
##########
@@ -88,6 +88,8 @@ impl<'a> UnalignedBitChunk<'a> {
}
// Read into prefix and suffix as needed
+ // Safety: u8 has alignment 1 so any byte slice can be aligned to u64;
u64 has no
Review Comment:
i dont think we need alignment in safety comment since `align_to` will
return the unaligned prefix/suffix already
##########
arrow-array/src/ffi.rs:
##########
@@ -482,7 +484,8 @@ impl ImportedArrowArray<'_> {
// we assume that pointer is aligned for `i32`, as Utf8 uses
`i32` offsets.
#[expect(clippy::cast_ptr_alignment)]
let offset_buffer = self.array.buffer(1).cast::<i32>();
- // get last offset
+ // Safety: `len` is the byte length of the offset buffer;
dividing by `size_of::<i32>()`
+ // gives the number of i32 elements, and the last index is
valid and within bounds.
Review Comment:
should we add a note why the `-1` is safe, or that is covered by mentioning
last index?
--
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]