Repository navigation
docs: add examples/lazy_check.py, a 5-minute check that a LazyFrame stays lazy - #544
Merged
Merged
Conversation
…tays lazy The script writes a Parquet file (5M rows by default, or the row count in argv), plans and applies a cleaning pass on a scan of it, and times suggest_plan, apply_plan and collect. It prints the Polars query plan. tests/test_lazy_check_example.py runs it on 1,000 rows, so the file the launch posts link to cannot break without a red test. The README links to it after the quickstart.
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
The launch plan needs one file that a Polars user can run in 5 minutes to see that a LazyFrame stays lazy. The posts must link a file in this repo, not a gist. The file was not in the repo (launch gate G4).
Change
examples/lazy_check.pywrites a Parquet file (5,000,000 rows by default, or the row count you give), plans and applies a cleaning pass onpl.scan_parquet, and timessuggest_plan,apply_planandcollect. It prints the Polars query plan and asserts thatapply_planreturns aLazyFrame.tests/test_lazy_check_example.pyruns the script on 1,000 rows.mkdocs build --strictrejects links to files outsidedocs/.No library code changes. No public behavior changes.
Check
Before (main
c0d175d):After:
Full suite:
110 passed, coverage 96.18%.ruff check .is clean. The README blocks run with exit 0.mkdocs build --strictexits 0.Script output (freshdata 3.0.0, polars 2.2.0, macOS)
apply_plantime does not grow with the row count, because it only builds expressions. The peak memory comes from the script's own data generation, not from freshdata.