coiled / benchmarks

BSD 3-Clause "New" or "Revised" License
32 stars 17 forks source link

tpc-h query operations aren't aligned across backends #1498

Open MarcoGorelli opened 7 months ago

MarcoGorelli commented 7 months ago

Hey

This is something which I think isn't quite right in the Polars repo either (and I've flagged it there too)

I think there's a few cases where operations are written in different orders - as dataframe libraries move towards query optimisation (🥳 ), I think it becomes more important that things be written in the same order, so that it's up to the query optimiser to reorder things

In Q5, the pandas API version is written as "filter, filter, merge, merge, merge, merge, merge"

https://github.com/coiled/benchmarks/blob/f9eda14db423d93d75c909790cfa679733db4846/tests/tpch/dask_queries.py#L177-L189

whereas the Polars one is written as "join, join, join, join, join, filter, filter"

https://github.com/coiled/benchmarks/blob/f9eda14db423d93d75c909790cfa679733db4846/tests/tpch/test_polars.py#L192-L202

Likewise in a few others


Granted, all benchmarks are wrong, just flagging it in case it can help improve Dask's query optimiser (especially if there's a chance that it'll end up powering pandas too 💪 )

phofl commented 7 months ago

Thanks! This is still from the benchmarks that we copied over from Polars (so that's the reason for the same ordering as over there). We have a bunch of cases in the queries that we wrote ourselves that push filters around, so not super worried functionality wise here.

We should adjust this anyway (feel free to open a PR if you're interested :)), but not super high priority for me personally