Repository navigation
Show the result of all optimizer passes in EXPLAIN VERBOSE - #759
Merged
Merged
Conversation
alamb
commented
Jul 20, 2021
| _, | ||
| ) => { | ||
| let schema = schema.as_ref().to_owned().into(); | ||
| optimize_explain( |
Contributor
Author
There was a problem hiding this comment.
this is the old style "explain" implementation that needed to be done for each optimizer for it to correctly show explain plans (and it was missing from several)
| plan_builder.append_value(&*p.plan)?; | ||
| match prev { | ||
| Some(prev) if !should_show(prev, p) => { | ||
| plan_builder.append_value("SAME TEXT AS ABOVE")?; |
Contributor
Author
There was a problem hiding this comment.
Once I started dumping out all the explain plans, the mount of replication was enormous, so I also added code to avoid duplication if the optimizer pass did not make any changes
NGA-TRAN
approved these changes
Jul 20, 2021
| schema: schema.clone(), | ||
| }) | ||
| } else { | ||
| self.optimize_internal(plan, |_, _| {}) |
Contributor
There was a problem hiding this comment.
Nice. Now we have the optimized plan displayed
| plan_builder.append_value(&*p.plan)?; | ||
| match prev { | ||
| Some(prev) if !should_show(prev, p) => { | ||
| plan_builder.append_value("SAME TEXT AS ABOVE")?; |
unkloud
pushed a commit
to unkloud/datafusion
that referenced
this pull request
Mar 23, 2025
* fix: Fallback to Spark for unsupported partitioning * fix * Move test * For review
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Which issue does this PR close?
Resolves #733
Rationale for this Change
Previously, only some logical optimizer passes (and no physical optimizer passes) were shown in
EXPLAIN VERBOSEoutput. This was due to the fact that each optimizer had to special case handling for explain and so unsurprisingly some (especially newly written ones) did not.What changes are included in this PR?
ExecutionContext::OptimizeAre there any user-facing changes?
Yes. Explain output is different. To see the difference, do
Then run
Before this change:
Note the reason the optimizer passes appear to be duplicated in this explain is because that is what actually happens -- optimize is called once as part of
ExecutionContext::sql()and again as part ofDataFrame_impl::collect()). If we want to avoid the double optimization, I think we should treat it separately and do so in a follow on PR. This PR faithfully captures what DataFusion is actually doing.After this change: