Skip to content

docs: add examples/lazy_check.py, a 5-minute check that a LazyFrame stays lazy - #544

Merged
JohnnyWilson16 merged 1 commit into
mainfrom
examples/lazy-check-jwd
Nov 28, 2026
Merged

JohnnyWilson16 merged 1 commit into
mainfrom
examples/lazy-check-jwd

Conversation

@JohnnyWilson16

Copy link
Copy Markdown
Contributor

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.py writes a Parquet file (5,000,000 rows by default, or the row count you give), plans and applies a cleaning pass on pl.scan_parquet, and times suggest_plan, apply_plan and collect. It prints the Polars query plan and asserts that apply_plan returns a LazyFrame.
  • tests/test_lazy_check_example.py runs the script on 1,000 rows.
  • The README links to the script after the quickstart. The link is an absolute URL, because the docs site includes the README and mkdocs build --strict rejects links to files outside docs/.

No library code changes. No public behavior changes.

Check

Before (main c0d175d):

E       AssertionError: /private/tmp/claude-501/venvs/rel/bin/python: can't open file '.../examples/lazy_check.py': [Errno 2] No such file or directory
1 failed in 0.37s

After:

1 passed in 1.19s

Full suite: 110 passed, coverage 96.18%. ruff check . is clean. The README blocks run with exit 0. mkdocs build --strict exits 0.

Script output (freshdata 3.0.0, polars 2.2.0, macOS)

Rows suggest_plan apply_plan collect Peak memory
500,000 2.2 ms 0.1 ms 5.2 ms 0.2 GB
5,000,000 4.3 ms 0.1 ms 28.1 ms not measured
50,000,000 26.3 ms 0.3 ms 640.1 ms 3.0 GB

apply_plan time 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.

…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.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: abc86b31-a04d-42f0-853e-5f9e1cf2c301
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@JohnnyWilson16
JohnnyWilson16 merged commit cda0494 into main Nov 28, 2026
14 checks passed
@JohnnyWilson16
JohnnyWilson16 deleted the examples/lazy-check-jwd branch November 28, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant