Dandandan commented on code in PR #8849:
URL: https://github.com/apache/arrow-rs/pull/8849#discussion_r2531916988
##########
arrow-select/src/take.rs:
##########
@@ -422,9 +422,10 @@ fn take_native<T: ArrowNativeType, I: ArrowPrimitiveType>(
.enumerate()
.map(|(idx, index)| match values.get(index.as_usize()) {
Some(v) => *v,
- None => match n.is_null(idx) {
- true => T::default(),
- false => panic!("Out-of-bounds index {index:?}"),
+ // SAFETY: idx<indices.len()
+ None => match unsafe { n.inner().value_unchecked(idx) } {
+ false => T::default(),
Review Comment:
I think we can't remove it - it checks the indices value is null as well to
make sure out of bounds on a non-null value leads to a panic.
So currently:
* out of bound with a null index value => default value (+ null in the
output)
* out of bounds with a non-null value => panic
We could consider out of bounds either always panics or always gives a
default (0) value but the current API (and tests) requires it to be this way
--
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]