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

   ### Describe the bug
   
   `NullBuilder::finish` is documented as "Builds the [NullArray] and reset 
this builder", but it never resets `len`; its body is identical to 
`finish_cloned`. A `NullBuilder` reused after `finish` therefore emits arrays 
whose lengths accumulate across calls, unlike every other builder. 
`ArrayBuilder::finish` delegates to the inherent method, so builders obtained 
through `make_builder(&DataType::Null, ..)` behave the same way.
   
   ### To Reproduce
   
   ```rust
   use arrow_array::builder::{ArrayBuilder, NullBuilder};
   
   let mut builder = NullBuilder::new();
   builder.append_nulls(10);
   assert_eq!(builder.finish().len(), 10);
   assert_eq!(builder.len(), 0); // fails: left 10
   
   builder.append_nulls(3);
   assert_eq!(builder.finish().len(), 3); // fails: left 13
   ```
   
   ### Expected behavior
   
   After `finish`, `len()` is 0 and the next `finish` returns only what was 
appended since, matching the doc comment and the other builders. 
`finish_cloned` already behaves correctly and should stay non-resetting.
   
   ### Additional context
   
   Reproduced on `main` at 8e517524b (after 60.0.0). Found through a shuffle 
writer that keeps one builder per output chunk: the `Null` column's emitted 
chunks summed to more rows than the partition held, and a downstream length 
check caught the mismatch.
   


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