-
Notifications
You must be signed in to change notification settings - Fork 14
Fix ArrowFlightReadExec result streaming #77
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
72dc970
Uncomment tests in favor of just #[ignore]-ing them
gabotechs 15e4edf
Remove unused import statements
gabotechs e4e2dbb
Move common tpch module to common
gabotechs 3f91003
Unignore one more test
gabotechs 17be2c5
Fix ArrowFlightReadExec
gabotechs 7987033
Merge branch 'main' into gabrielmusat/fix-arrow-flight-read
gabotechs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| pub mod result; | ||
| pub mod util; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| pub mod insta; | ||
| pub mod localhost; | ||
| pub mod parquet; | ||
| pub mod plan; | ||
| pub mod tpch; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| use datafusion::common::plan_err; | ||
| use datafusion::common::tree_node::{Transformed, TreeNode}; | ||
| use datafusion::error::DataFusionError; | ||
| use datafusion::physical_expr::Partitioning; | ||
| use datafusion::physical_plan::aggregates::{AggregateExec, AggregateMode}; | ||
| use datafusion::physical_plan::ExecutionPlan; | ||
| use datafusion_distributed::ArrowFlightReadExec; | ||
| use std::sync::Arc; | ||
|
|
||
| pub fn distribute_aggregate( | ||
| plan: Arc<dyn ExecutionPlan>, | ||
| ) -> Result<Arc<dyn ExecutionPlan>, DataFusionError> { | ||
| let mut aggregate_partial_found = false; | ||
| Ok(plan | ||
| .transform_up(|node| { | ||
| let Some(agg) = node.as_any().downcast_ref::<AggregateExec>() else { | ||
| return Ok(Transformed::no(node)); | ||
| }; | ||
|
|
||
| match agg.mode() { | ||
| AggregateMode::Partial => { | ||
| if aggregate_partial_found { | ||
| return plan_err!("Two consecutive partial aggregations found"); | ||
| } | ||
| aggregate_partial_found = true; | ||
| let expr = agg | ||
| .group_expr() | ||
| .expr() | ||
| .iter() | ||
| .map(|(v, _)| Arc::clone(v)) | ||
| .collect::<Vec<_>>(); | ||
|
|
||
| if node.children().len() != 1 { | ||
| return plan_err!("Aggregate must have exactly one child"); | ||
| } | ||
| let child = node.children()[0].clone(); | ||
|
|
||
| let node = node.with_new_children(vec![Arc::new(ArrowFlightReadExec::new( | ||
| Partitioning::Hash(expr, 1), | ||
| child.schema(), | ||
| 0, | ||
| ))])?; | ||
| Ok(Transformed::yes(node)) | ||
| } | ||
| AggregateMode::Final | ||
| | AggregateMode::FinalPartitioned | ||
| | AggregateMode::Single | ||
| | AggregateMode::SinglePartitioned => { | ||
| if !aggregate_partial_found { | ||
| return plan_err!("No partial aggregate found before the final one"); | ||
| } | ||
|
|
||
| if node.children().len() != 1 { | ||
| return plan_err!("Aggregate must have exactly one child"); | ||
| } | ||
| let child = node.children()[0].clone(); | ||
|
|
||
| let node = node.with_new_children(vec![Arc::new(ArrowFlightReadExec::new( | ||
| Partitioning::RoundRobinBatch(8), | ||
| child.schema(), | ||
| 1, | ||
| ))])?; | ||
| Ok(Transformed::yes(node)) | ||
| } | ||
| } | ||
| })? | ||
| .data) | ||
| } |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think this is fine. As this is pure IO work, I think it's fair to not spawn it and just join it in a single thread
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.
That was my thought too, but I left the comment so that we'd get an additional perspective. Ty 👍