wangshuo128 commented on a change in pull request #31968:
URL: https://github.com/apache/spark/pull/31968#discussion_r610532321
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala
##########
@@ -71,7 +72,26 @@ class QueryExecution(
lazy val analyzed: LogicalPlan = executePhase(QueryPlanningTracker.ANALYSIS)
{
// We can't clone `logical` here, which will reset the `_analyzed` flag.
- sparkSession.sessionState.analyzer.executeAndCheck(logical, tracker)
+ val plan = sparkSession.sessionState.analyzer.executeAndCheck(logical,
tracker)
+
+ // For various commands (like DDL) and queries with side effects, we force
query execution
+ // to happen right away to let these side effects take place eagerly.
+ def runCommand(plan: LogicalPlan): LogicalPlan = {
+ val qe = new QueryExecution(sparkSession, plan, isCommand = true)
+ LocalRelation(plan.output,
+ SQLExecution.withNewExecutionId(qe)(qe.executedPlan.executeCollect()),
+ fromCommand = true)
+ }
+
+ if (isCommand) {
+ plan
+ } else {
+ plan.transformUp {
Review comment:
oops... should follow the previous behavior, will fix.
--
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]