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): add LazyFileListReader trait #6937

Merged
merged 2 commits into from
Feb 17, 2023

Conversation

mslapek
Copy link
Contributor

@mslapek mslapek commented Feb 16, 2023

The new trait LazyFileListReader deduplicates glob logic in the polars-lazy crate.

It makes much easier to add glob support to other formats, see ndjson #6638 issue.

Breaking changes

NO breaking changes are intended in this PR.

I've assumed that _impl methods are not part of the public API (if that's not the case, it's trivial to fix).

Some glob error messages are streamlined among file formats.

API philosophical discussion

There is a small inconsistency in polars-lazy, i.e. there are 2 reader conventions:

  1. Struct WITHOUT path, named Scan
  2. Struct WITH path, named Reader

I've chosen (arbitrarily) the second one for the design of the trait... 🤔

The first one might be potentially more elegant with factory metaphor:

scan.finish(Path) -> LazyFrame

@github-actions github-actions bot added refactor Code improvements that do not change functionality rust Related to Rust Polars labels Feb 16, 2023
@mslapek
Copy link
Contributor Author

mslapek commented Feb 16, 2023

CI breaks in the same place as the merged PR #6940 (which on master passes tests).

That's surprising... 🤨 Maybe CI must be somehow reconfigured?

@ritchie46
Copy link
Member

A rebase should work.

Copy link
Member

@ritchie46 ritchie46 left a comment

Choose a reason for hiding this comment

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

Thanks @mslapek looks good. I have one small nit for the file name and then it is good to go.

polars/polars-lazy/src/frame/mod.rs Outdated Show resolved Hide resolved
@ritchie46 ritchie46 merged commit 19096ff into pola-rs:master Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code improvements that do not change functionality rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants