xudong963 commented on code in PR #23424:
URL: https://github.com/apache/datafusion/pull/23424#discussion_r3557443865
##########
datafusion/common/src/utils/mod.rs:
##########
@@ -1236,16 +1236,7 @@ pub fn adjust_offsets_for_slice<O: OffsetSizeTrait>(
) -> OffsetBuffer<O> {
let offsets = list.offsets();
- if let (Some(first), Some(last)) = (offsets.first(), offsets.last())
- && (!first.is_zero() || last.as_usize() != list.values().len())
- {
- let offsets = offsets.iter().map(|offset| *offset - *first).collect();
-
- //todo: use unsafe Offset::new_unchecked?
- return OffsetBuffer::new(offsets);
- }
-
- offsets.clone()
+ offsets.clone().subtract(offsets[0])
Review Comment:
For a prefix slice where the first offset is zero but the last visible
offset is before the end of the original child values, `subtract(0)` returns a
clone sharing the original allocation. The previous
Implementation created a compact offset buffer in this case.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]