connec commented on issue #11472:
URL: https://github.com/apache/datafusion/issues/11472#issuecomment-2235974826

   Turns out `arrow-csv` does correctly parse newlines in quoted values, so the 
issue comes from reading CSVs in parallel. Limiting the target number of 
partitions to 1 solves the issue.
   
   For example, if I add this to my code before I run `ctx.sql("SELECT * FROM 
<csv including linebreaks>")` then the query executed successfully (without it 
there are errors about wrong numbers of columns):
   
   ```rust
   ctx.state_weak_ref()
       .upgrade()
       .unwrap()
       .write_arc()
       .config_mut()
       .options_mut()
       .execution
       .target_partitions = 1;
   ```
   
   From a UX perspective, this setting is quite disconnected from the intent. 
It also required changing the session-level `target_partitions` setting, which 
(I assume, untested) would adversely affect reads of CSVs that might not be 
expected to contain linebreaks. A per-CSV `newlines_in_values` setting would 
help to signpost this situation and allow more efficient plans when only some 
executed CSVs have this requirement.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to