rluvaton commented on code in PR #9176:
URL: https://github.com/apache/arrow-rs/pull/9176#discussion_r2703985521
##########
arrow-row/src/lib.rs:
##########
@@ -506,6 +506,38 @@ enum Codec {
Union(Vec<RowConverter>, Vec<OwnedRow>),
}
+/// Computes the minimum offset and maximum end (offset + size) for a ListView
array.
+/// Returns (min_offset, max_end) which can be used to slice the values array.
+fn compute_list_view_bounds<O: OffsetSizeTrait>(array:
&GenericListViewArray<O>) -> (usize, usize) {
+ if array.is_empty() {
+ return (0, 0);
+ }
+
+ let offsets = array.value_offsets();
+ let sizes = array.value_sizes();
+
+ let mut min_offset = usize::MAX;
+ let mut max_end = 0usize;
+
+ for i in 0..array.len() {
+ let offset = offsets[i].as_usize();
+ let size = sizes[i].as_usize();
+ let end = offset + size;
+
+ if size > 0 {
+ min_offset = min_offset.min(offset);
+ max_end = max_end.max(end);
Review Comment:
Maybe you can break if you reached maximum bounds (0 and maximum value that
can be)
--
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]