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

refactor(rust!): Move CSV read options from CsvReader to CsvReadOptions #16126

Merged
merged 14 commits into from
May 10, 2024

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented May 9, 2024

This is a refactoring to move CSV read options from the CsvReader out to the options struct. This will make it easier to create multiple readers from the same set of options for the new CSV file list reading implementation.

This PR should not change any read behavior, only the way in which a CsvReader is constructed.

Todos after this:

  • Try removing the override of the encoding to LossyUtf8 (2 places)
Outdated

This is currently in a state where it builds for Python, and the layout of the options struct is pretty much what I aimed for it to be. What's left is just updating tests / docs on the rust side, but it's will be better to wait until after we review the new layout (as there are a lot of them).

@nameexhaustion nameexhaustion changed the title Refactor CSV options [wip] Refactor CSV options May 9, 2024
@nameexhaustion nameexhaustion marked this pull request as draft May 9, 2024 10:05
Copy link

codecov bot commented May 10, 2024

Codecov Report

Attention: Patch coverage is 96.87500% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 80.95%. Comparing base (c4e8678) to head (b6b00c3).

Files Patch % Lines
crates/polars-io/src/csv/read/reader.rs 95.95% 4 Missing ⚠️
py-polars/src/dataframe/io.rs 90.24% 4 Missing ⚠️
crates/polars-io/src/csv/read/options.rs 98.83% 2 Missing ⚠️
py-polars/src/batched_csv.rs 92.59% 2 Missing ⚠️
crates/polars-io/src/csv/read/read_impl.rs 88.88% 1 Missing ⚠️
crates/polars-lazy/src/scan/csv.rs 83.33% 1 Missing ⚠️
py-polars/src/lazyframe/visitor/nodes.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16126      +/-   ##
==========================================
- Coverage   80.96%   80.95%   -0.01%     
==========================================
  Files        1386     1386              
  Lines      178437   178492      +55     
  Branches     2882     2882              
==========================================
+ Hits       144463   144496      +33     
- Misses      33480    33502      +22     
  Partials      494      494              

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

@nameexhaustion nameexhaustion changed the title [wip] Refactor CSV options refactor(rust!): Move CSV read options from CsvReader to CsvReadOptions May 10, 2024
@github-actions github-actions bot added breaking rust Change that breaks backwards compatibility for the Rust crate internal An internal refactor or improvement rust Related to Rust Polars labels May 10, 2024
@nameexhaustion nameexhaustion marked this pull request as ready for review May 10, 2024 06:27
@ritchie46
Copy link
Member

Nice one @nameexhaustion! Great cleanup. 💪

@ritchie46 ritchie46 merged commit c1a1a01 into pola-rs:main May 10, 2024
30 checks passed
@nameexhaustion nameexhaustion deleted the csv-opts branch May 10, 2024 08:25
Wouittone pushed a commit to Wouittone/polars that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking rust Change that breaks backwards compatibility for the Rust crate internal An internal refactor or improvement rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants