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

   **Describe the bug**
   
   Collecting to a `BooleanArray` produces unintuitive results if the upper 
bound of the iterator is an over estimation. At least I think after looking at 
the code.
   
   Is this intended behavior? If not, I could try to come up with a fix.
   
   **To Reproduce**
   
   The following test reproduces this:
   
   ```rust
       #[test]
       fn test_boolean_array_from() {
           let values = vec![Some(true), None, Some(true), Some(false)]
               .into_iter()
               .filter(Option::is_some)
               .collect::<BooleanArray>();
           assert_debug_snapshot!(values, @r"
           BooleanArray
           [
             true,
             true,
             false,
             null,
           ]
           ")
       }
   ```
   
   **Expected behavior**
   
   I'd have expected the following Array (without the null):
   
   ```
           BooleanArray
           [
             true,
             true,
             false,
           ]
   ```
   
   **Additional context**
   
   The result of the "same" operation on an Int64Array:
   
   ```rust
       #[test]
       fn test_int64_array_from() {
           let values = vec![Some(1), None, Some(2), Some(3)]
               .into_iter()
               .filter(Option::is_some)
               .collect::<Int64Array>();
           assert_debug_snapshot!(values, @r"
           PrimitiveArray<Int64>
           [
             1,
             2,
             3,
           ]
           ")
       }
   ```


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