wangshuo128 commented on a change in pull request #31968:
URL: https://github.com/apache/spark/pull/31968#discussion_r607702903



##########
File path: 
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala
##########
@@ -64,9 +65,15 @@ private[hive] class SparkSQLDriver(val context: SQLContext = 
SparkSQLEnv.sqlCont
         new VariableSubstitution().substitute(command)
       }
       context.sparkContext.setJobDescription(substitutorCommand)
-      val execution = 
context.sessionState.executePlan(context.sql(command).logicalPlan)
-      hiveResponse = SQLExecution.withNewExecutionId(execution) {

Review comment:
       As discussed in 
https://github.com/apache/spark/pull/31968#discussion_r603155308
   When run `sql("show tables").show`, we would see 3 SQL queries in Spark SQL 
UI:
   
   Query0 `sql("show tables")`: execute the `ShowTablesCommand `
   
   Query 1 `show`:  the logical plan is the same with query 0, triggered in 
`Dataset.getRows` 
https://github.com/apache/spark/blob/3b634f66c3e4a942178a1e322ae65ce82779625d/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala#L291
   
   Query2 `show`:  show the result of the command in `LogicalRelation` 
   
   We can check the `LogicalRelation.fromCommand` flag and don't produce 
`executionId` for query2 in `SQLExecution.withNewExecutionId`,  any thoughts?




-- 
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]

Reply via email to