-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28901][SQL] SparkThriftServer's Cancel SQL Operation show it in JDBC Tab UI #25611
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 1 commit
b84d385
07d5679
187a4a6
44ba723
e8f902e
d4d1943
7d77b0c
72b885d
d2d6cc5
4c9d5f1
7b43b59
3744fc9
5070161
41ab7d7
87fa08f
63e8b59
bea260a
7e56c14
8b25006
ccd7de9
c6651f1
00f3553
8b84e04
ff5ac96
28174bd
1cbf7cc
61c9c73
f720963
c8d2ffc
536756b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,7 +169,10 @@ private[hive] class SparkExecuteStatementOperation( | |
| parentSession.getUsername) | ||
|
|
||
| if (!runInBackground) { | ||
| executeWhenNotTerminalStatus() | ||
| if (getStatus.getState.isTerminal) { | ||
| return | ||
| } | ||
| execute() | ||
| } else { | ||
| val sparkServiceUGI = Utils.getUGI() | ||
|
|
||
|
|
@@ -182,7 +185,10 @@ private[hive] class SparkExecuteStatementOperation( | |
| override def run(): Unit = { | ||
| registerCurrentOperationLog() | ||
| try { | ||
| executeWhenNotTerminalStatus() | ||
| if (getStatus.getState.isTerminal) { | ||
| return | ||
| } | ||
| execute() | ||
| } catch { | ||
| case e: HiveSQLException => | ||
| setOperationException(e) | ||
|
|
@@ -219,12 +225,6 @@ private[hive] class SparkExecuteStatementOperation( | |
| } | ||
| } | ||
|
|
||
| private def executeWhenNotTerminalStatus(): Unit = { | ||
| if(!getStatus.getState.isTerminal) { | ||
| execute() | ||
| } | ||
| } | ||
|
|
||
| private def execute(): Unit = withSchedulerPool { | ||
| try { | ||
| logInfo(s"Running query '$statement' with $statementId") | ||
|
|
@@ -261,9 +261,7 @@ private[hive] class SparkExecuteStatementOperation( | |
| // HiveServer will silently swallow them. | ||
| case e: Throwable => | ||
|
Contributor
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. @AngersZhuuuu I think it can be fixed by:
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. Got you point. But cancelJobGroup here seem can't stop |
||
| val currentState = getStatus().getState() | ||
| if (currentState == OperationState.CANCELED || | ||
| currentState == OperationState.CLOSED || | ||
| currentState == OperationState.FINISHED) { | ||
| if (currentState.isTerminal) { | ||
|
Contributor
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. ocd nit:
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. |
||
| // This may happen if the execution was cancelled, and then closed from another thread. | ||
| logWarning(s"Ignore exception in terminal state with $statementId: $e") | ||
| return | ||
AngersZhuuuu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
@@ -290,8 +288,9 @@ private[hive] class SparkExecuteStatementOperation( | |
| override def cancel(): Unit = { | ||
| synchronized { | ||
| if (!getStatus.getState.isTerminal) { | ||
| setState(OperationState.FINISHED) | ||
| HiveThriftServer2.listener.onStatementFinish(statementId) | ||
| logInfo(s"Cancel '$statement' with $statementId") | ||
|
||
| cleanup(OperationState.CANCELED) | ||
| HiveThriftServer2.listener.onStatementCanceled(statementId) | ||
| } | ||
| } | ||
| } | ||
|
|
||

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.
promise final nit: remove double empty line