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



##########
File path: arrow/src/compute/kernels/filter.rs
##########
@@ -1521,4 +1521,102 @@ mod tests {
 
         assert_eq!(&expected, &got);
     }
+
+    #[test]
+    fn test_filter_fixed_size_list_arrays() {
+        let value_data = ArrayData::builder(DataType::Int32)
+            .len(9)
+            .add_buffer(Buffer::from_slice_ref(&[0, 1, 2, 3, 4, 5, 6, 7, 8]))
+            .build()
+            .unwrap();
+        let list_data_type = DataType::FixedSizeList(
+            Box::new(Field::new("item", DataType::Int32, false)),
+            3,
+        );
+        let list_data = ArrayData::builder(list_data_type)
+            .len(3)
+            .add_child_data(value_data)
+            .build()
+            .unwrap();
+        let array = FixedSizeListArray::from(list_data);
+
+        let filter_array = BooleanArray::from(vec![true, false, false]);
+
+        let c = filter(&array, &filter_array).unwrap();
+        let filtered = 
c.as_any().downcast_ref::<FixedSizeListArray>().unwrap();
+
+        assert_eq!(filtered.len(), 1);
+
+        let list = filtered.value(0);
+        assert_eq!(
+            &[0, 1, 2],
+            list.as_any().downcast_ref::<Int32Array>().unwrap().values()
+        );
+
+        let filter_array = BooleanArray::from(vec![true, false, true]);

Review comment:
       👍  for taking something other than the first element




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