You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to see DataFusion added to h2oai/db-benchmark so that we can see how we compare to other solutions (including Pandas, Spark, cuDF, and Polars).
Since Polars (another Rust DataFrame library that uses Arrow) has already been added, I am hoping that we can learn from their scripts.
There is an issue filed against db-benchmark for adding DataFusion:
below are the current results i have after adding join queries:
group by
q1 took 56 ms
q2 took 289 ms
q3 took 1305 ms
q4 took 69 ms
q5 took 1158 ms
q7 took 1198 ms
q10 took 24691 ms
join
q1 took 261 ms
q2 took 367 ms
q3 took 334 ms
q4 took 507 ms
q5 took 1936 ms
below are the current results i have after adding join queries:
group by
q1 took 56 ms
q2 took 289 ms
q3 took 1305 ms
q4 took 69 ms
q5 took 1158 ms
q7 took 1198 ms
q10 took 24691 ms
join
q1 took 261 ms
q2 took 367 ms
q3 took 334 ms
q4 took 507 ms
q5 took 1936 ms
Thank you very much @matthewmturner. From looking at your results and extrapolating a bit from my earlier benchmarking and published results it seems like DF does very well on the join queries. Hopefully we can do some real comparisons later.
I also see the code which used to load data into partitions using Mentale::load now loads it into 1 partition (with try_new). Not sure if the difference is still big as we now do Round Robin repartitioning of the data, but would maybe still save a bit.
@Dandandan my understanding of what i did was set the expected partitions at the ExecutionContext / ExecutionConfig level and then collect that into record batches from a DataFrame with df.collect_partitioned which would take into account the target partitions. That being said i had to play around with that a lot to get a MemTable so im not confident its doing what i expected. I'll look into it a little more though.
If what i did was incorrect is there a more idiomatic way to create a MemTable with the desired number of partitions?
Separately, i havent been able to find docs on the supported math functions. Any info you could provide on that?
Went through the code and found the math functions that are supported. I think it would be nice to add documentation to the datafusion site on what's supported. But of course that is a separate topic - i've created an issue for it.
I think for the more advanced group by queries we'll need to add median, standard dev, and correlation functions. ive created an issue for adding those as well - but hopefully we can submit benchmark without those and add them when the functionality is added.
i think we'll be able to add query 8, going to work on that.
I think for the more advanced group by queries we'll need to add median, standard dev, and correlation functions. ive created an issue for adding those as well - but hopefully we can submit benchmark without those and add them when the functionality is added.
FWIW standard deviation and correlation can be calculated using the existing aggregation functions (aka AVG(X) and AVG(X^2)), numerical precision issues not withstanding
Median is harder -- I think it will need special casing as it can't be calculated using partial aggregates
I feel a bit silly for asking this, but is the ability to raise a value / column to a power implemented in datafusion? I've tried the below ways with no luck. Am I missing something obvious?
DataFusion CLI v5.1.0
❯ select 2**2; 🤔 Invalid statement: sql parser error: Expected end of statement, found: 2
im also curious what people think about using the python bindings instead of rust? there are existing utilities we could leverage if so. however, can we generate an optimized build for python like we are in rust?
I feel a bit silly for asking this, but is the ability to raise a value / column to a power implemented in datafusion? I've tried the below ways with no luck. Am I missing something obvious?
I thought it was pow or power but when I tried to dig around I didn't find it implemented. I filed #1493 to track
im also curious what people think about using the python bindings instead of rust? there are existing utilities we could leverage if so. however, can we generate an optimized build for python like we are in rust?
In general, I think using the python bindings is a great idea for integration of datafusion with other systems. I don't know how very much about how to build / use them, but I would love to see more documentation on the process :)
Only about half(5) of the engines benchmarked even complete these so that already puts us in a pretty good spot. However, of those that do complete it we are on the slower side - about tied with the current slowest.
however as @Dandandan noted this is without some optimizations in place. im going to work on adding those next.
also im going to work on building an automation script so anyone can run this benchmark themselves and play with optimizations they have in mind.
@realno FYI see above for latest - as i know you expressed a specific interest in this.
I am actually reading this and the slack channel, lol :D Thanks @matthewmturner for the update and progress! I will definitely participate in optimization as much as I can. This is a great start!
@realno oh and I had an issue with the approx_median function. I ended up having to use the quantile function instead. I didn't really get the chance to look into it though.
@realno oh and I had an issue with the approx_median function. I ended up having to use the quantile function instead. I didn't really get the chance to look into it though.
I will look into it. If you can gather some info and create an issue please tag me on it. Thanks!
Activity
matthewmturner commentedon Dec 25, 2021
@alamb @houqp FYI i am picking up on the work @Dandandan started on this.
below are the current results i have after adding join queries:
Dandandan commentedon Dec 25, 2021
Thank you very much @matthewmturner. From looking at your results and extrapolating a bit from my earlier benchmarking and published results it seems like DF does very well on the join queries. Hopefully we can do some real comparisons later.
jon-chuang commentedon Dec 25, 2021
@matthewmturner I'm assuming that's on the 0.5 GB bench?
It does seem to be a little lacking for group by in comparison to polars and others.
matthewmturner commentedon Dec 25, 2021
Yes. I still need to double check table setup and queries to make sure it's apples to apples though - so take it with a grain of salt for the moment.
Dandandan commentedon Dec 25, 2021
I also see the code which used to load data into partitions using
Mentale::loadnow loads it into 1 partition (withtry_new). Not sure if the difference is still big as we now do Round Robin repartitioning of the data, but would maybe still save a bit.matthewmturner commentedon Dec 26, 2021
@Dandandan my understanding of what i did was set the expected partitions at the
ExecutionContext/ExecutionConfiglevel and then collect that into record batches from aDataFramewithdf.collect_partitionedwhich would take into account the target partitions. That being said i had to play around with that a lot to get aMemTableso im not confident its doing what i expected. I'll look into it a little more though.If what i did was incorrect is there a more idiomatic way to create a
MemTablewith the desired number of partitions?Separately, i havent been able to find docs on the supported math functions. Any info you could provide on that?
matthewmturner commentedon Dec 26, 2021
Went through the code and found the math functions that are supported. I think it would be nice to add documentation to the datafusion site on what's supported. But of course that is a separate topic - i've created an issue for it.
I think for the more advanced group by queries we'll need to add median, standard dev, and correlation functions. ive created an issue for adding those as well - but hopefully we can submit benchmark without those and add them when the functionality is added.
i think we'll be able to add query 8, going to work on that.
alamb commentedon Dec 26, 2021
FWIW standard deviation and correlation can be calculated using the existing aggregation functions (aka
AVG(X)andAVG(X^2)), numerical precision issues not withstandingMedian is harder -- I think it will need special casing as it can't be calculated using partial aggregates
matthewmturner commentedon Dec 26, 2021
@alamb yes agree. The median is needed in same query with std deviation but im going to try adding the one with correlation
matthewmturner commentedon Dec 26, 2021
I feel a bit silly for asking this, but is the ability to raise a value / column to a power implemented in datafusion? I've tried the below ways with no luck. Am I missing something obvious?
I get the same errors when running on table columns
matthewmturner commentedon Dec 26, 2021
im also curious what people think about using the python bindings instead of rust? there are existing utilities we could leverage if so. however, can we generate an optimized build for python like we are in rust?
@houqp @alamb
alamb commentedon Dec 27, 2021
I thought it was
poworpowerbut when I tried to dig around I didn't find it implemented. I filed #1493 to trackalamb commentedon Dec 27, 2021
In general, I think using the python bindings is a great idea for integration of datafusion with other systems. I don't know how very much about how to build / use them, but I would love to see more documentation on the process :)
15 remaining items
matthewmturner commentedon Feb 23, 2022
Another cross post from slack
This is the latest with the new groupby queries (6 and 9) included:
Only about half(5) of the engines benchmarked even complete these so that already puts us in a pretty good spot. However, of those that do complete it we are on the slower side - about tied with the current slowest.
however as @Dandandan noted this is without some optimizations in place. im going to work on adding those next.
also im going to work on building an automation script so anyone can run this benchmark themselves and play with optimizations they have in mind.
matthewmturner commentedon Feb 23, 2022
@realno FYI see above for latest - as i know you expressed a specific interest in this.
realno commentedon Feb 23, 2022
I am actually reading this and the slack channel, lol :D Thanks @matthewmturner for the update and progress! I will definitely participate in optimization as much as I can. This is a great start!
matthewmturner commentedon Feb 23, 2022
@realno oh and I had an issue with the approx_median function. I ended up having to use the quantile function instead. I didn't really get the chance to look into it though.
realno commentedon Feb 23, 2022
I will look into it. If you can gather some info and create an issue please tag me on it. Thanks!
alamb commentedon Mar 7, 2023
I think this issue is now complete
Sliding Hash Join Algorithm (SWHJ) (#147)
Global join selection (#183)
Projection Pushdown (#211)
Sliding Hash Join Algorithm (SWHJ) (#147)
Global join selection (#183)
Projection Pushdown (#211)
fix: Avoid null exception in removeSubquery (apache#147)
replace master with main (apache#147)