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

   # Which issue does this PR close?
   
   Closes #11735.
   
   # Rationale for this change
   
   With `ReaderBuilder::with_utf8_view(true)`, every NULL of a nullable string 
field is read as a non-null `""`. The `StringView` arm of `Decoder::flush` 
builds a `StringArray` with the correct null buffer, then maps it to a 
`Vec<&str>` with NULLs replaced by `""` and calls 
`StringViewArray::from(values)`, which creates an array without nulls.
   
   # What changes are included in this PR?
   
   The `StringView` arm now converts with `StringViewArray::from(&array)`. That 
keeps the null buffer, and it also reuses the values buffer instead of copying 
each string.
   
   # Are these changes tested?
   
   Yes. `test_utf8view_keeps_nulls` writes `[Some("a"), None, Some(""), None, 
Some("b")]` to an OCF file, reads it back with `with_utf8_view(true)`, and 
compares with the expected `StringViewArray`. It fails without the fix. `cargo 
test -p arrow-avro --all-features` passes, and `cargo clippy -p arrow-avro 
--all-targets --all-features -- -D warnings` is clean.
   
   # Are there any user-facing changes?
   
   No API changes. Nullable string fields read with `with_utf8_view(true)` now 
keep their NULLs.
   
   AI use: Claude Code (AI) helped trace the decoder and wrote the first draft 
of the fix, the test and this description; I reviewed and ran everything.
   


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