viirya opened a new issue, #11377:
URL: https://github.com/apache/arrow-rs/issues/11377

   ### Describe the bug
   
   Calling the public `FilterPredicate::filter_nulls` with an input containing 
nulls panics when the predicate selects all rows or no rows.
   
   These predicates use `IterationStrategy::All` and `IterationStrategy::None`. 
Unlike `filter(array)`, `filter_nulls` does not handle these strategies before 
calling `filter_bits`, which marks both as `unreachable!()`.
   
   ### To Reproduce
   
   Reproduced at commit `8c265f8de4e44a5fdda8aad79ccf890d53c6e601`:
   
   ```rust
   use arrow_array::BooleanArray;
   use arrow_buffer::NullBuffer;
   use arrow_select::filter::FilterBuilder;
   
   let nulls = NullBuffer::from(vec![true, false]);
   
   // Each call independently panics with "internal error: entered unreachable 
code".
   let all = FilterBuilder::new(&BooleanArray::from(vec![true, true])).build();
   assert_eq!(all.filter_nulls(Some(&nulls)), Some(nulls.clone()));
   
   let none = FilterBuilder::new(&BooleanArray::from(vec![false, 
false])).build();
   assert_eq!(none.filter_nulls(Some(&nulls)), None);
   ```
   
   ### Expected behavior
   
   Selecting all rows should return the null buffer restricted to the 
predicate's length, or `None` if that range contains no nulls. Selecting no 
rows, including with an empty predicate, should return `None`.
   
   ### Additional context
   
   This affects direct calls to the public method. The normal array filtering 
entry point already handles both strategies. Inputs with no nulls already 
return `None` without reaching the failing code.
   
   This is an existing edge-case defect; it is not attributed to recent 
FixedSizeBinary filtering changes.
   


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