alamb commented on a change in pull request #1228:
URL: https://github.com/apache/arrow-rs/pull/1228#discussion_r796667308



##########
File path: arrow/src/compute/kernels/filter.rs
##########
@@ -693,4 +630,61 @@ mod tests {
         assert_eq!(out.data_type(), &DataType::Int64);
         Ok(())
     }
+

Review comment:
       I wrote another test to convince myself this one was correct and I think 
it also helps serve as a test:
   
   ```suggestion
   
       #[test]
       fn test_slices() {
           // takes up 2 u64s
           let bools = std::iter::repeat(true).take(10)
               .chain(std::iter::repeat(false).take(30))
               .chain(std::iter::repeat(true).take(20))
               .chain(std::iter::repeat(false).take(17))
               .chain(std::iter::repeat(true).take(4));
   
           let bool_array: BooleanArray = bools.map(Some).collect();
   
           let slices: Vec<_> = SlicesIterator::new(&bool_array).collect();
           let expected = vec![(0, 10), (40, 60), (77, 81)];
           assert_eq!(slices, expected);
   
           // slice with offset and truncated len
           let len = bool_array.len();
           let sliced_array = bool_array.slice(7, len-10);
           let sliced_array = sliced_array
               .as_any()
               .downcast_ref::<BooleanArray>()
               .unwrap();
           let slices: Vec<_> = SlicesIterator::new(&sliced_array).collect();
           let expected = vec![(0, 3), (33, 53), (70, 71)];
           assert_eq!(slices, expected);
       }
   ```




-- 
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]


Reply via email to