juliuszsompolski commented on a change in pull request #25611:
[SPARK-28901][SQL] SparkThriftServer's Cancel SQL Operation show it in JDBC Tab
UI
URL: https://github.com/apache/spark/pull/25611#discussion_r319960659
##########
File path:
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala
##########
@@ -213,21 +223,15 @@ private[hive] class SparkExecuteStatementOperation(
}
private def execute(): Unit = withSchedulerPool {
- statementId = UUID.randomUUID().toString
- logInfo(s"Running query '$statement' with $statementId")
- setState(OperationState.RUNNING)
- // Always use the latest class loader provided by executionHive's state.
- val executionHiveClassLoader = sqlContext.sharedState.jarClassLoader
- Thread.currentThread().setContextClassLoader(executionHiveClassLoader)
-
- HiveThriftServer2.listener.onStatementStart(
- statementId,
- parentSession.getSessionHandle.getSessionId.toString,
- statement,
- statementId,
- parentSession.getUsername)
- sqlContext.sparkContext.setJobGroup(statementId, statement)
try {
+ logInfo(s"Running query '$statement' with $statementId")
+ setState(OperationState.RUNNING)
Review comment:
I'd change that to
```
synchronized {
if (getStatus.getState.isTerminal) {
logInfo(s"Query with $statementId in terminal state before it started
running")
return
} else {
logInfo(s"Running query with $statementId")
setState(OperationState.RUNNING)
}
}
```
instead of the `if` in `runInternal`. Otherwise, it can still change the
state to cancelled between there and here.
(note: removed $statement from the log message; let's log it during
submission)
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]