CaptainAni187 opened a new pull request, #54683:
URL: https://github.com/apache/arrow/pull/54683

   ### Rationale for this change
   
   With a one-column table, a null gets written as the empty null_string 
followed by the eol, so the row is just an empty line. The CSV reader skips 
empty lines by default, so every null row is lost on a write_csv / read_csv 
round trip.
   
   ### What changes are included in this PR?
   
   When the schema has a single column and null_string is empty, the writer now 
writes nulls as `""` instead of nothing. A quoted empty value already reads 
back as null for non-string columns (quoted_strings_can_be_null), and the row 
is kept for string columns too.
   
   It only kicks in for that one case. A custom null_string, tables with more 
than one column, and QuotingStyle::None keep the old output. I left None alone 
since it promises no quotes at all.... happy to change that if you'd rather it 
also writes `""`.
   
   Also added a note about this on WriteOptions::null_string.
   
   ### Are these changes tested?
   
   Yes. Updated the existing SingleColumnWriteCSVTest case (it was asserting 
the empty line), added cases for Needed, AllValid, None, a custom null_string, 
a string column and two columns, plus a round trip test that writes a 
one-column table with nulls and reads it back with default options.
   
   ### Are there any user-facing changes?
   
   Yes, single-column CSV output with nulls changes from an empty line to `""` 
(with the default empty null_string).
   
   ### Was AI used for this PR?
   
   In accordance to the [AI generation 
guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code),
 please disclose below whether and how AI was used in this PR.
   
   The fix, tests and this description were drafted with Claude Code.
   
   **PR code and description written by:**
   
   - [ ] Human
   - [x] AI
   
   **Reviewed before submission by:**
   
   - [ ] Human
   - [x] AI
   - [ ] Not reviewed
   
   * GitHub Issue: #54535
   


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