New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARROW-9754: [Rust] [DataFusion] Implement async in ExecutionPlan trait #8285
Conversation
Currently fails to compile due to
@BatmanAoD I was wondering if you might know what is causing this? |
fyi @jorgecarleitao @alamb This is some groundwork for async that the scheduler will need |
Hm, I'd guess it's probably because of the |
Yes, I think it's because the |
I agree with this: what we want from ExecutionPlan's
which is exactly what |
Thanks @BatmanAoD that was it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this change @andygrove -- I think it is a great step forward and is a great start towards running DataFusion more efficiently. I would be happy if it were merged!
ctx.state.config.concurrency = 1; | ||
ctx.register_table("aggregate_test_100", Box::new(mem_table)); | ||
ctx | ||
unimplemented!() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
working on this now ... about to push the fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was that I couldn't call async code from criterion so I had to create a separate tokio runtime and block on some async code. I expect that there may be a cleaner way to do this.
for chunk in chunks { | ||
let chunk = chunk.to_vec(); | ||
let input = self.input.clone(); | ||
let task: JoinHandle<Result<Vec<Arc<RecordBatch>>>> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is really much nicer in my opinion -- we spawn tasks (not threads) -- and thus we won't create more threads than cpus and give users better control over how the tasks are run. 👍
rust/rust-toolchain
Outdated
@@ -1 +1 @@ | |||
nightly-2020-04-22 | |||
nightly-2020-08-24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this upgrade was helpful during development, but I suggest we don't upgrade upon final merge.
@alamb @jorgecarleitao I just realized that once this PR is merged, I could go ahead and implement join support because it should be relatively efficient now that MergeExec is executing tasks not threads. I'm not sure which is the higher priority for 2.0.0 out of implementing joins (just inner equijoins for now) or implementing the scheduler. What are your thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Really great, @andygrove .
I +1 the one that you think you will have the most fun working on :-) If both are equally fun, I would go for the joins, just because feature-wise IMO it is one of the two major features that we are missing (together with windowing). This is because the type of queries I am used to use a lot of joins - it may not be so relevant for other folks. |
@jorgecarleitao I know how to implement joins, but I am still learning on the scheduler front, so I think it would make more sense to ship join support in 2.0.0 and this may make DataFusion more compelling for a larger audience. I could then focus on scheduling for the next release. |
Sounds like a good plan @andygrove -- regarding the scheduler I may have time to help out in a few weeks as well as it is directly applicable to what I am working on at work I actually think the move to async will help a lot (by partly constraining the implementation). I am also very happy to review / help out with Joins (but I will have limited time to do so as they are not directly relevant to what I am doing for work) |
This PR implements async in the ExecutionPlan trait. I ran the TPC-H benchmark and the performance is about the same. Master branch: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14365 ms Query 1 iteration 1 took 14284 ms Query 1 iteration 2 took 14269 ms ``` This PR: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14305 ms Query 1 iteration 1 took 14372 ms Query 1 iteration 2 took 14323 ms ``` _EDIT: I previously posted perf numbers that were marginally better but that was due to using a more recent Rust nightly during the development of this PR._ Closes apache#8285 from andygrove/async-execution Authored-by: Andy Grove <andygrove73@gmail.com> Signed-off-by: Andy Grove <andygrove73@gmail.com>
This PR implements async in the ExecutionPlan trait. I ran the TPC-H benchmark and the performance is about the same. Master branch: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14365 ms Query 1 iteration 1 took 14284 ms Query 1 iteration 2 took 14269 ms ``` This PR: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14305 ms Query 1 iteration 1 took 14372 ms Query 1 iteration 2 took 14323 ms ``` _EDIT: I previously posted perf numbers that were marginally better but that was due to using a more recent Rust nightly during the development of this PR._ Closes apache#8285 from andygrove/async-execution Authored-by: Andy Grove <andygrove73@gmail.com> Signed-off-by: Andy Grove <andygrove73@gmail.com>
This PR implements async in the ExecutionPlan trait. I ran the TPC-H benchmark and the performance is about the same. Master branch: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14365 ms Query 1 iteration 1 took 14284 ms Query 1 iteration 2 took 14269 ms ``` This PR: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14305 ms Query 1 iteration 1 took 14372 ms Query 1 iteration 2 took 14323 ms ``` _EDIT: I previously posted perf numbers that were marginally better but that was due to using a more recent Rust nightly during the development of this PR._ Closes apache#8285 from andygrove/async-execution Authored-by: Andy Grove <andygrove73@gmail.com> Signed-off-by: Andy Grove <andygrove73@gmail.com>
This PR implements async in the ExecutionPlan trait. I ran the TPC-H benchmark and the performance is about the same. Master branch: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14365 ms Query 1 iteration 1 took 14284 ms Query 1 iteration 2 took 14269 ms ``` This PR: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14305 ms Query 1 iteration 1 took 14372 ms Query 1 iteration 2 took 14323 ms ``` _EDIT: I previously posted perf numbers that were marginally better but that was due to using a more recent Rust nightly during the development of this PR._ Closes apache#8285 from andygrove/async-execution Authored-by: Andy Grove <andygrove73@gmail.com> Signed-off-by: Andy Grove <andygrove73@gmail.com>
This PR implements async in the ExecutionPlan trait. I ran the TPC-H benchmark and the performance is about the same. Master branch: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14365 ms Query 1 iteration 1 took 14284 ms Query 1 iteration 2 took 14269 ms ``` This PR: ``` Running benchmarks with the following options: TpchOpt { query: 1, debug: false, iterations: 3, concurrency: 24, batch_size: 4096, path: "/mnt/tpch/parquet/100-240", file_format: "parquet" } Query 1 iteration 0 took 14305 ms Query 1 iteration 1 took 14372 ms Query 1 iteration 2 took 14323 ms ``` _EDIT: I previously posted perf numbers that were marginally better but that was due to using a more recent Rust nightly during the development of this PR._ Closes apache#8285 from andygrove/async-execution Authored-by: Andy Grove <andygrove73@gmail.com> Signed-off-by: Andy Grove <andygrove73@gmail.com>
This PR implements async in the ExecutionPlan trait. I ran the TPC-H benchmark and the performance is about the same.
Master branch:
This PR:
EDIT: I previously posted perf numbers that were marginally better but that was due to using a more recent Rust nightly during the development of this PR.