Skip to content

polars/polars-collect-then-write

Rule polars-collect-then-write
Pack Polars
Severity info
Fix unsafe, with xpd check --fix --unsafe-fixes
Library versions every version

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")

Eager write and streaming sink produced equal data after reading their files.

Use xpd check --fix --unsafe-fixes to replace .collect().write_* with the matching .sink_* call when collect takes no arguments.

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

Collect builds a DataFrame before writing. Use a matching sink when only the file is needed.

Browse the other rules of the Polars pack.