duongcongtoai commented on code in PR #8652:
URL: https://github.com/apache/arrow-rs/pull/8652#discussion_r2616807753
##########
arrow-data/src/transform/utils.rs:
##########
@@ -58,6 +61,37 @@ pub(super) unsafe fn get_last_offset<T:
ArrowNativeType>(offset_buffer: &Mutable
*unsafe { offsets.get_unchecked(offsets.len() - 1) }
}
+fn iter_in_bytes_variable_sized<T: ArrowNativeType + Integer>(data:
&ArrayData) -> Vec<&[u8]> {
+ let offsets = data.buffer::<T>(0);
+
+ // the offsets of the `ArrayData` are ignored as they are only applied to
the offset buffer.
+ let values = data.buffers()[1].as_slice();
+ (0..data.len())
+ .map(move |i| {
+ let start = offsets[i].to_usize().unwrap();
+ let end = offsets[i + 1].to_usize().unwrap();
+ &values[start..end]
+ })
+ .collect::<Vec<_>>()
+}
+
+fn iter_in_bytes_fixed_sized(data: &ArrayData, size: usize) -> Vec<&[u8]> {
+ let values = &data.buffers()[0].as_slice()[data.offset() * size..];
+ values.chunks(size).collect::<Vec<_>>()
+}
+
+/// iterate values in raw bytes regardless nullability
+pub(crate) fn iter_in_bytes<'a>(data_type: &DataType, data: &'a ArrayData) ->
Vec<&'a [u8]> {
Review Comment:
i renamed
--
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]