Skip to content

Commit

Permalink
remove assert and switch to i32 try from.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachelint committed Jan 29, 2025
1 parent 51d0a87 commit 85ed001
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions datafusion/functions-aggregate/src/median.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ impl<T: ArrowNumericType + Send> GroupsAccumulator for MedianGroupsAccumulator<T
.with_data_type(self.data_type.clone());

// `offsets` in `ListArray`, each row as a list element
assert!(input_array.len() <= i32::MAX as usize);
let offsets = (0..=input_array.len() as i32).collect::<Vec<_>>();
let offset_end = i32::try_from(input_array.len()).unwrap();
let offsets = (0..=offset_end).collect::<Vec<_>>();
// Safety: all checks in `OffsetBuffer::new` are ensured to pass
let offsets = unsafe { OffsetBuffer::new_unchecked(ScalarBuffer::from(offsets)) };

Expand Down

0 comments on commit 85ed001

Please sign in to comment.