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

   ### Rationale for this change
   
   Currently the CSV writer only supports double-quote escaping (RFC4180 
default). This PR adds `EscapeStyle` to `WriteOptions` to support three escape 
modes, aligning with `readr::write_csv()`'s `escape` argument.
   
   ### What changes are included in this PR?
   
   - New `EscapeStyle` enum in `options.h`: `Double`, `Backslash`, `None`
   - New `escape_style` field in `WriteOptions` (default: `EscapeStyle::Double` 
for backward compatibility)
   - Updated `Escape()` in `writer.cc` to handle all three escape styles
   - `EscapedLength()` helper for accurate buffer size calculation
   - Header writing also respects `escape_style`
   - Test cases for backslash and none escape styles
   
   ### Are these changes tested?
   
   Yes, added test cases:
   - `EscapeStyle::Backslash` with and without header
   - `EscapeStyle::None` (quotes not escaped)
   
   ### Are there any user-facing changes?
   
   Yes, users can now set `options.escape_style` to `EscapeStyle::Backslash` or 
`EscapeStyle::None` in addition to the default `EscapeStyle::Double`.
   
   Closes #30431


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