-
Couldn't load subscription status.
- Fork 1.7k
Support EXPLAIN ... FORMAT <indent | tree | json | graphviz > ...
#15166
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
Conversation
d2e0d63 to
aa53939
Compare
aa53939 to
b23e3cd
Compare
EXPLAIN ... FORMAT <indent | tree | json | graphviz > ...EXPLAIN ... FORMAT <indent | tree | json | graphviz > ...
b23e3cd to
187f38e
Compare
| .. | ||
| } => { | ||
| self.explain_to_plan(verbose, analyze, DFStatement::Statement(statement)) | ||
| let format = format.map(|format| format.to_string()); |
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.
Not very related to this PR, will we change sqlparser part to use a String instead of enum like here? (I'd prefer so, as it gives us more flexibility)
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 that would be a fine idea to propose upstream in sqlparser
I am not aware of any plans at the moment
187f38e to
c965e8e
Compare
Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
| TreeRender, | ||
| } | ||
|
|
||
| impl FromStr for DisplayFormatType { |
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 superceded by the ExplainFormat
| statement ok | ||
| drop table t2; | ||
|
|
||
| ## Tests for explain format |
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.
Here are the tests showing how this works
|
FYI @irenjj |
…o alamb/explan_format
|
Thanks @alamb ! |
|
I'll take a look at others later today.❤️ |
| displayable(optimized_plan.as_ref()).to_stringified( | ||
| e.verbose, | ||
| FinalPhysicalPlan, | ||
| DisplayFormatType::TreeRender, | ||
| ), |
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.
Maybe we can add a new function to handle tree explain like display_pg_json, then the third parameter is no longer needed as I found the values passed in below are all default values.
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 is a good idea -- I will try 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 did it in a83ec4e and i think it looks much nicer ❤️
|
Thanks @alamb , others LGTM. |
This is a good idea -- thank you. I did it in 31f402d |
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.
Which issue does this PR close?
EXPLAINformats via SQL #15021Rationale for this change
I would like to be able to see more of the great explain plan code that DataFusion already has (see #15021 for details)
What changes are included in this PR?
Changes:
EXPLAIN VERBOSE FORMAT ...indentmodetreemodepgjsonmodegraphvizmodeHere is an example
Are these changes tested?
Are there any user-facing changes?