polars/polars-eager-read-before-query
| Rule | polars-eager-read-before-query |
|---|---|
| Pack | Polars |
| Severity | info |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | every version |
Start this lazy query with a scan to enable projection and predicate pushdown. On 50,000 and 500,000 Parquet rows the scan ran 4.64 and 32.60 times faster.
pl.read_parquet("data.parquet").lazy().filter(expr > 1).select("x")pl.scan_parquet("data.parquet").filter(expr > 1).select("x")What the rule reports
Section titled “What the rule reports”4.64x and 32.60x with one thread and row group pruning.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to replace read_*.lazy() with the matching scan_* call.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
Start this lazy query with a scan to enable projection and predicate pushdown. On 50,000 and 500,000 Parquet rows the scan ran 4.64 and 32.60 times faster.Browse the other rules of the Polars pack.