Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add CSV sink for the new streaming engine #20804

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

coastalwhite
Copy link
Collaborator

ping @orlp.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Jan 20, 2025
@@ -221,15 +221,20 @@ fn to_graph_rec<'a>(
nodes::io_sinks::ipc::IpcSinkNode::new(input_schema, path, ipc_writer_options)?,
[(input_key, input.port)],
),
#[cfg(feature = "ipc")]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by: this was not correct

.with_float_precision(options.serialize_options.float_precision)
.with_null_value(options.serialize_options.null.clone())
.with_quote_style(options.serialize_options.quote_style)
.n_threads(1) // Disable rayon parallelism
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was easy. :)


let mut buffer = Vec::with_capacity(allocation_size);
let mut writer = CsvWriter::new(&mut buffer)
.include_bom(false) // Handled once in the IO task.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can hoist the writer out of the while loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it matters much since the CsvWriter creation is cheap, and we cannot reuse the allocation anyway because it needs to be passed to the IO task.

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

Attention: Patch coverage is 0% with 103 lines in your changes missing coverage. Please review.

Project coverage is 79.75%. Comparing base (f0aa09b) to head (0d4aa8b).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-stream/src/nodes/io_sinks/csv.rs 0.00% 103 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20804      +/-   ##
==========================================
- Coverage   79.77%   79.75%   -0.03%     
==========================================
  Files        1561     1562       +1     
  Lines      222029   222397     +368     
  Branches     2533     2533              
==========================================
+ Hits       177132   177369     +237     
- Misses      44313    44444     +131     
  Partials      584      584              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit 5c261c0 into pola-rs:main Jan 22, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants