polars/polars-collect-then-write
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| Polars | info | unsafe, with xpd check --fix --unsafe-fixes |
All versions |
Collect builds a DataFrame before writing. Use a matching sink when only the file is needed.
lf.collect().write_parquet("data.parquet")lf.sink_parquet("data.parquet")What the rule reports
Section titled “What the rule reports”Eager write and streaming sink produced equal data after reading their files.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to replace .collect().write_* with the matching .sink_* call when collect takes no arguments.
Diagnostic message
Section titled “Diagnostic message”Collect builds a DataFrame before writing. Use a matching sink when only the file is needed.See all rules in the Polars pack.