rluvaton commented on code in PR #23424:
URL: https://github.com/apache/datafusion/pull/23424#discussion_r3553235067
##########
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()
Review Comment:
Even though this code has `last != list.values().len()` and the subtract
doesn't have that check, that check is not needed as we don't touch the last
values at all
##########
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()
Review Comment:
Even though this code has `last != list.values().len()` and the subtract
doesn't have that check, that check is not needed as we don't use the last
values at all
--
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]