alamb commented on a change in pull request #939:
URL: https://github.com/apache/arrow-rs/pull/939#discussion_r747002058
##########
File path: arrow/src/compute/kernels/take.rs
##########
@@ -1813,6 +1824,38 @@ mod tests {
.unwrap();
}
+ #[test]
+ fn test_null_array_smaller_than_indices() {
+ let values = NullArray::new(2);
+ let indices = UInt32Array::from(vec![Some(0), None, Some(15)]);
+
+ let result = take(&values, &indices, None).unwrap();
+ let expected: ArrayRef = Arc::new(NullArray::new(3));
+ assert_eq!(&result, &expected);
+ }
+
+ #[test]
+ fn test_null_array_larger_than_indices() {
+ let values = NullArray::new(5);
+ let indices = UInt32Array::from(vec![Some(0), None, Some(15)]);
+
+ let result = take(&values, &indices, None).unwrap();
+ let expected: ArrayRef = Arc::new(NullArray::new(3));
+ assert_eq!(&result, &expected);
+ }
+
+ #[test]
+ fn test_null_array_indices_out_of_bounds() {
Review comment:
👍 for this test -- I was going to say something about validating bounds
of the take indexes but this covers it. 👍
--
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]