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 option to include file path for Parquet, IPC, CSV scans #17563

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented Jul 11, 2024

Closes #10481

This introduces an include_file_paths parameter, which accepts a column name to use for the column storing the file path.

pl.scan_csv(
    ["https://j.mp/iriscsv", ".env/iris.csv"], include_file_paths="path"
).collect()
shape: (300, 6)
┌──────────────┬─────────────┬──────────────┬─────────────┬───────────┬─────────────────────────────────┐
│ sepal_lengthsepal_widthpetal_lengthpetal_widthspeciespath                            │
│ ------------------                             │
│ f64f64f64f64strstr                             │
╞══════════════╪═════════════╪══════════════╪═════════════╪═══════════╪═════════════════════════════════╡
│ 5.13.51.40.2setosahttps://j.mp/iriscsv            │
│ 4.93.01.40.2setosahttps://j.mp/iriscsv            │
│ 4.73.21.30.2setosahttps://j.mp/iriscsv            │
│ 4.63.11.50.2setosahttps://j.mp/iriscsv            │
│ 5.03.61.40.2setosahttps://j.mp/iriscsv            │
│ …            ┆ …           ┆ …            ┆ …           ┆ …         ┆ …                               │
│ 6.73.05.22.3virginicafile:////Users/nxs/git/polars/… │
│ 6.32.55.01.9virginicafile:////Users/nxs/git/polars/… │
│ 6.53.05.22.0virginicafile:////Users/nxs/git/polars/… │
│ 6.23.45.42.3virginicafile:////Users/nxs/git/polars/… │
│ 5.93.05.11.8virginicafile:////Users/nxs/git/polars/… │
└──────────────┴─────────────┴──────────────┴─────────────┴───────────┴─────────────────────────────────┘

@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 Jul 11, 2024
Copy link

codecov bot commented Jul 11, 2024

Codecov Report

Attention: Patch coverage is 97.80702% with 5 lines in your changes missing coverage. Please review.

Project coverage is 80.46%. Comparing base (64b45a8) to head (b77b7a4).

Files Patch % Lines
crates/polars-io/src/parquet/read/read_impl.rs 97.67% 1 Missing ⚠️
crates/polars-lazy/src/scan/ndjson.rs 50.00% 1 Missing ⚠️
crates/polars-mem-engine/src/executors/scan/csv.rs 92.30% 1 Missing ⚠️
crates/polars-pipe/src/executors/sources/csv.rs 95.00% 1 Missing ⚠️
...lan/src/plans/optimizer/projection_pushdown/mod.rs 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17563      +/-   ##
==========================================
+ Coverage   80.45%   80.46%   +0.01%     
==========================================
  Files        1484     1484              
  Lines      195341   195509     +168     
  Branches     2778     2778              
==========================================
+ Hits       157154   157310     +156     
- Misses      37675    37687      +12     
  Partials      512      512              

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

@@ -16,19 +16,19 @@ use crate::prelude::optimizer::predicate_pushdown::join::process_join;
use crate::prelude::optimizer::predicate_pushdown::rename::process_rename;
use crate::utils::{check_input_node, has_aexpr};

pub type HiveEval<'a> =
pub type ExprEval<'a> =
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 - rename to ExprEval as it is a generic evaluator

@ritchie46
Copy link
Member

Nice one! Can you rebase?

@nameexhaustion
Copy link
Collaborator Author

rebased 👍

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.

Add option to include source filename and filepath in dataframe
2 participants