ranflarion opened a new pull request, #11110:
URL: https://github.com/apache/arrow-rs/pull/11110

   # Which issue does this PR close?
   
   - Closes #11109.
   
   # Rationale for this change
   
   `NullBuilder::finish` is documented to reset the builder but its body is the 
same as `finish_cloned`, so a builder reused across `finish` calls emits 
cumulative lengths. Every other builder resets on `finish`.
   
   # What changes are included in this PR?
   
   `finish` takes the length with `std::mem::take`, leaving the builder empty. 
`finish_cloned` is unchanged.
   
   # Are these changes tested?
   
   Yes. `test_null_array_builder_finish_resets` finishes twice and checks the 
builder is empty in between; it fails on `main` (`left: 0, right: 10`) and 
passes with the change. `cargo test -p arrow-array`, `-p arrow-csv` and `-p 
parquet-variant-compute` pass; the two other in-tree callers of 
`NullBuilder::finish` each finish a fresh builder once, so their output does 
not change.
   
   # Are there any user-facing changes?
   
   `NullBuilder::finish` now resets the builder as documented. Code that relied 
on the previous non-resetting behavior would see shorter arrays from subsequent 
`finish` calls; that behavior contradicted the doc comment and every other 
builder. No API 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