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: scan_csv #1555

Merged
merged 3 commits into from
Dec 10, 2024
Merged

feat: scan_csv #1555

merged 3 commits into from
Dec 10, 2024

Conversation

raisadz
Copy link
Contributor

@raisadz raisadz commented Dec 10, 2024

What type of PR is this? (check all applicable)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

@github-actions github-actions bot added the enhancement New feature or request label Dec 10, 2024
@raisadz raisadz marked this pull request as ready for review December 10, 2024 15:06
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

thanks! there's some merge conflicts, plus some minor comments

Comment on lines 948 to 949
This allows the query optimizer to push down predicates and projections
to the scan level, thereby potentially reducing memory overhead.
Copy link
Member

Choose a reason for hiding this comment

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

this is Polars-specific, perhaps we can remove it?

... return (
... nw.scan_csv("file.csv", native_namespace=native_namespace)
... .to_native()
... .collect()
Copy link
Member

Choose a reason for hiding this comment

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

collect isn't guaranteed to be present on a native frame, can we keep it out of agnostic_scan_csv? you can just put collect as the end of the Polars example, and compute at the end of the dask example

either that, or put collect before to_native

Comment on lines 3396 to 3397
This allows the query optimizer to push down predicates and projections
to the scan level, thereby potentially reducing memory overhead.
Copy link
Member

Choose a reason for hiding this comment

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

same

... .collect()
... )

Then we can read the file by passing Polars or dask namespaces:
Copy link
Member

Choose a reason for hiding this comment

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

how about

by passing, for example, Polars or Dask namespaces

?

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

so good, thanks @raisadz !

@MarcoGorelli MarcoGorelli merged commit ade07ae into narwhals-dev:main Dec 10, 2024
24 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 request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants