cloud-fan commented on a change in pull request #32513:
URL: https://github.com/apache/spark/pull/32513#discussion_r633599281
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala
##########
@@ -74,12 +74,23 @@ class QueryExecution(
sparkSession.sessionState.analyzer.executeAndCheck(logical, tracker)
}
+ lazy val commandCollected: LogicalPlan = analyzed mapChildren { child =>
+ child transform {
+ // SPARK-35378: Eagerly execute Command so that query command with CTE
+ case c: Command =>
+ val subQueryExecution = sparkSession.sessionState.executePlan(c)
+ LocalRelation(c.output,
+ subQueryExecution.executedPlan.executeCollect(), false,
Some(subQueryExecution.id))
Review comment:
How about we create new query plan nodes: `CommandResult` and
`CommandResultExec`
```
case class CommandResult(qe: QueryExecution) extends LeadNode {
def innerChildren = Seq(qe.analyzedPlan)
def output = qe.logicalPlan.output
}
case class CommandResultExec(qe: QueryExecution) extends LeafNodeExec {
def innerChildren = Seq(qe.executedPlan)
def output = qe.logicalPlan.output
}
```
then both UI and EXPLAIN can have pretty output.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]