Fix issue 791: add LazyFrame sink classes for parquet, csv, ipc, ndjson - #1653
Fix issue 791: add LazyFrame sink classes for parquet, csv, ipc, ndjson#1653sonalishintre wants to merge 7 commits into
Conversation
jernejfrank
left a comment
There was a problem hiding this comment.
Hi @sonalishintre and welcome. Thanks for taking the time to contribute. In general looks good just a couple of remarks to keep it consistent with the rest of the existing implementations (see below).
If you look at the https://github.com/apache/hamilton/blob/main/hamilton/plugins/polars_post_1_0_0_extensions.py you will see the same implementations for the eager frame and can see the class naming conventions and order in which the classes appear. Could you try to mirror that?
Otherwise looking good and great job!
|
Hi @jernejfrank — I've made the requested changes:
Please let me know if any further changes are needed! |
|
Thanks for the update. I took another pass through the latest revision and found a few things that should be addressed before merging:
For reference, the functional test file passes locally ( |
|
@sonalishintre let me know if any of the above are unclear or you need help with any of the points. Happy to sketch it out / point to the right places so you can get this over the line |
|
Hi @jernejfrank — I've addressed all the feedback:
18/20 tests pass locally. The 2 failures (test_polars_database, Please let me know if anything else is needed! Thank you |
Hey, opened a smal PR on your side: sonalishintre#1 to show the thigns that are missing |
Make streaming sinks the sole adapters for supported LazyFrame formats while preserving eager writers for DataFrames. Align sink options with Polars and cover registry and materializer resolution. Refs apache#1653
|
Hi @jernejfrank, 27/29 tests now pass locally. The 2 remaining failures Please let me know if everything looks good now! |
Make streaming sinks the sole adapters for supported LazyFrame formats while preserving eager writers for DataFrames. Align sink options with Polars and cover registry and materializer resolution. Refs apache#1653
a9ef804 to
1a4577f
Compare
|
Hi @jernejfrank — I investigated the CI failures locally:
Could you help clarify what's failing in CI? I don't have access |
Hey, apologies this is a bit of a bumpy ride. Just pushed the small fixes missing in your PR. Let me check why plotly is failing (this is not related to you PR, so no need to worry about here). Will do my best to land this ASAP for you |
Summary
Closes #791
Adds data sink support for Polars LazyFrames, allowing users to write
LazyFrames directly to disk without calling lf.collect() first, which
is more performant.
Changes
PolarsLazyFrameSinkParquetclassPolarsLazyFrameSinkCSVclassPolarsLazyFrameSinkIPCclassPolarsLazyFrameSinkNDJSONclassregister_data_loaders()How I tested this
Added 4 new tests in
tests/plugins/test_polars_lazyframe_extensions.py:test_polars_lazyframe_sink_parquet✅test_polars_lazyframe_sink_csv✅test_polars_lazyframe_sink_ipc✅test_polars_lazyframe_sink_ndjson✅Each test creates a LazyFrame, sinks it to a temp file, reads it back,
and verifies the data matches.
Notes
sink_ndjsonhas no corresponding loader yet as noted in the issueChecklist