-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Show optimized physical and logical plans in EXPLAIN #744
Conversation
@@ -749,32 +754,9 @@ impl DefaultPhysicalPlanner { | |||
"Unsupported logical plan: CreateExternalTable".to_string(), | |||
)) | |||
} | |||
LogicalPlan::Explain { |
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.
previously the physical planner could handle an LogicalPlan::Explain
anywhere in the tree. However, I can't think if cases where this can actually occur and it made adding the final physical plan challenging.
So I have changed the code to special case handling Explain
as the root.
datafusion/tests/sql.rs
Outdated
@@ -47,6 +47,41 @@ use datafusion::{ | |||
}; | |||
use datafusion::{execution::context::ExecutionContext, physical_plan::displayable}; | |||
|
|||
/// Copied from datafusion/test/mod.rs | |||
/// TODO: consolidate |
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 basically a copy/paste from test/mod.rs -- I have plans to fix this in #743
FYI @Dandandan |
f1e1162
to
18c0b4b
Compare
FYI @Dandandan since you requested the original feature |
Thanks, looks great! @alamb |
Which issue does this PR close?
Closes #221
Rationale for this change
"The EXPLAIN command is useful to show the plan of the query engine. However, the current output shows the un-optimized logical plan, which is not very useful as it maps almost 1:1 to the query."
Most users issue an
EXPLAIN
command to see what the query engine is actually going to run.What changes are included in this PR?
Change EXPLAIN to show the optimized logical plan (after all logical optimizer passes) and optimized physical plan (after all physical optimizer passes).
Working with sql.rs reminded me of my goal for cleaning up sql tests, and so I filed #743
Are there any user-facing changes?
Explain plan output is different
For example, before this PR
and after this PR (note the inclusion of the projection pushdown and physical plan)