andygrove commented on issue #26169: URL: https://github.com/apache/datafusion/issues/26169#issuecomment-7366872535
I opened an experimental draft PR, #27985, to see how far incremental changes to the existing planner, statistics, and operators can close the gap with Polars. It is not meant to be merged. Changes that hold up would be split into focused PRs with tests. On TPC-H SF100 (Parquet, 16 cores / 32 threads, best of 3): | | total | |---|---:| | DataFusion `main` | 134.1 s | | draft PR | 63.8 s | | Polars 2.2 (streaming) | 58.5 s | That is 2.1x faster than `main` and within 9% of Polars. It is faster than Polars on 7 of the 22 queries. The biggest contributors: - **`target_partitions` = physical cores** instead of logical threads. Running 32 partitions on 16 cores slows down cache-heavy operators. About 12%. - **Parquet filter pushdown on.** All filter conditions are combined into one `RowFilter`. A filter with no join-generated (dynamic) part is pushed only when it lets the reader skip decoding other columns. This also needed an arrow-rs fix: with a sparse selection, the reader decoded huge runs of rows before filtering. About 30%. - **Better estimates for choosing the hash join build side.** Pushed-down filters count toward scan row estimates. Composite keys get a combined distinct-value estimate. The build side is chosen by rows rather than bytes. q17 goes from 14.4 s to 2.5 s. - **Partial aggregation stays small enough to fit in cache.** q18 goes from 11.0 s to 5.0 s. - **A repeated subplan is computed once** using the existing `MaterializedCte`. q15 goes from 5.9 s to 2.0 s. - **Join keys that are aggregate results move into the join filter**, so dynamic filters reach below the aggregate. This works like magic-set decorrelation. q2 goes from 1.7 s to 0.59 s. The largest remaining gaps are: - q9 (hash join probe and build cost) - q8 - q2 and q11 (q11 is a repeated subplan that differs only by projection) - q12 and q16 - decimals: DataFusion widens `DECIMAL(15,2)` from 8 to 16 bytes at decode The full write-up, including what was tried and dropped, is in `benchmarks/polars-gap/REPORT.md` on the PR branch. This work was done with Claude Code. Details are in the PR's AI usage disclosure. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
