Skip to content

Commit 85ed001

Browse files
committed
remove assert and switch to i32 try from.
1 parent 51d0a87 commit 85ed001

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

datafusion/functions-aggregate/src/median.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,8 @@ impl<T: ArrowNumericType + Send> GroupsAccumulator for MedianGroupsAccumulator<T
450450
.with_data_type(self.data_type.clone());
451451

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

0 commit comments

Comments
 (0)