forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Distribution error failing in the SanityCheck, for a specific influxql plan. #58
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
90280ea
test: recreating the iox plan:
wiedld f792cfa
test: reproducer of SanityCheck failure after EnforceSorting removes …
wiedld 202860b
fix: special case to not remove the needed coalesce
wiedld 1c10b8b
fix(ci): build error with wasm (#14494)
Lordworms 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 |
|---|---|---|
|
|
@@ -37,7 +37,7 @@ | |
|
|
||
| use std::sync::Arc; | ||
|
|
||
| use super::utils::{add_sort_above, add_sort_above_with_check}; | ||
| use super::utils::{add_sort_above, add_sort_above_with_check, is_aggregation}; | ||
| use crate::config::ConfigOptions; | ||
| use crate::error::Result; | ||
| use crate::physical_optimizer::replace_with_order_preserving_variants::{ | ||
|
|
@@ -516,7 +516,7 @@ fn remove_bottleneck_in_subplan( | |
| ) -> Result<PlanWithCorrespondingCoalescePartitions> { | ||
| let plan = &requirements.plan; | ||
| let children = &mut requirements.children; | ||
| if is_coalesce_partitions(&children[0].plan) { | ||
| if is_coalesce_partitions(&children[0].plan) && !is_aggregation(plan) { | ||
| // We can safely use the 0th index since we have a `CoalescePartitionsExec`. | ||
| let mut new_child_node = children[0].children.swap_remove(0); | ||
| while new_child_node.plan.output_partitioning() == plan.output_partitioning() | ||
|
|
@@ -2261,21 +2261,20 @@ mod tests { | |
| get_plan_string(&optimized), | ||
| vec![ | ||
| "SortPreservingMergeExec: [a@0 ASC]", | ||
| " SortExec: expr=[a@0 ASC], preserve_partitioning=[true]", | ||
| " SortExec: expr=[a@0 ASC], preserve_partitioning=[false]", | ||
| " AggregateExec: mode=SinglePartitioned, gby=[a@0 as a1], aggr=[]", | ||
| " ProjectionExec: expr=[a@0 as a, b@1 as value]", | ||
| " UnionExec", | ||
| " ParquetExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e]", | ||
| " ParquetExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e]", | ||
| " CoalescePartitionsExec", | ||
| " ProjectionExec: expr=[a@0 as a, b@1 as value]", | ||
| " UnionExec", | ||
| " ParquetExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e]", | ||
| " ParquetExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e]", | ||
| ], | ||
| ); | ||
|
|
||
| // Plan is now invalid. | ||
| // Plan is valid. | ||
| let checker = SanityCheckPlan::new(); | ||
| let err = checker | ||
| .optimize(optimized, &Default::default()) | ||
| .unwrap_err(); | ||
| assert!(err.message().contains(" does not satisfy distribution requirements: HashPartitioned[[a@0]]). Child-0 output partitioning: UnknownPartitioning(2)")); | ||
| let checker = checker.optimize(optimized, &Default::default()); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really like the idea of running the SanityChecker as part of the tests |
||
| assert!(checker.is_ok()); | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is the fix, for now.
A proper fix (if we decide to fix at this conditional) should be comparing the partitioning needs of the parent (of coalesce) vs children of coalesce. My initial attempt to do so caused other DF tests to fail.
I didn't proceed further since I'm unsure of the correct solution at a higher level.
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.
Should this be checking that it is an aggregation and that that the aggregation mode is
SinglePartitioned🤔