-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17078] [SQL] Show stats when explain #16594
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
Changes from 7 commits
e25e71e
d08f4e0
b7c3a13
18b8d54
9fe22a5
491ec8f
b3457a0
6e10f84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -282,7 +282,11 @@ class SparkSqlAstBuilder(conf: SQLConf) extends AstBuilder { | |
| if (statement == null) { | ||
| null // This is enough since ParseException will raise later. | ||
| } else if (isExplainableStatement(statement)) { | ||
| ExplainCommand(statement, extended = ctx.EXTENDED != null, codegen = ctx.CODEGEN != null) | ||
| ExplainCommand( | ||
| logicalPlan = statement, | ||
| extended = ctx.EXTENDED != null, | ||
| codegen = ctx.CODEGEN != null, | ||
| cost = ctx.COST != null) | ||
|
Member
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. Need to fix the style.
Contributor
Author
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. Can you give a clue on the style?
Member
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. |
||
| } else { | ||
| ExplainCommand(OneRowRelation) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,11 +88,13 @@ case class ExecutedCommandExec(cmd: RunnableCommand) extends SparkPlan { | |
| * @param logicalPlan plan to explain | ||
| * @param extended whether to do extended explain or not | ||
| * @param codegen whether to output generated code from whole-stage codegen or not | ||
| * @param cost whether to show cost information for operators. | ||
| */ | ||
| case class ExplainCommand( | ||
| logicalPlan: LogicalPlan, | ||
| extended: Boolean = false, | ||
| codegen: Boolean = false) | ||
| codegen: Boolean = false, | ||
| cost: Boolean = false) | ||
|
Member
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. Please add |
||
| extends RunnableCommand { | ||
|
|
||
| override val output: Seq[Attribute] = | ||
|
|
@@ -113,6 +115,8 @@ case class ExplainCommand( | |
| codegenString(queryExecution.executedPlan) | ||
| } else if (extended) { | ||
| queryExecution.toString | ||
| } else if (cost) { | ||
| queryExecution.toStringWithStats | ||
| } else { | ||
| queryExecution.simpleString | ||
| } | ||
|
|
||
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.
also put in it
nonReservedThere 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.
Yes. Also please update the
hiveNonReservedKeywordinTableIdentifierParserSuiteThere 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.
Thanks! Updated.