-
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 5 commits
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
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,7 +138,7 @@ object HiveThriftServer2 extends Logging { | |
| } | ||
|
|
||
| private[thriftserver] object ExecutionState extends Enumeration { | ||
| val STARTED, COMPILED, FAILED, FINISHED, CLOSED = Value | ||
| val STARTED, COMPILED, CANCELED, FAILED, FINISHED, CLOSED = Value | ||
| type ExecutionState = Value | ||
| } | ||
|
|
||
|
|
@@ -239,6 +239,15 @@ object HiveThriftServer2 extends Logging { | |
| executionList(id).state = ExecutionState.COMPILED | ||
| } | ||
|
|
||
| def onStatementCanceled(id: String): Unit = { | ||
| synchronized { | ||
| executionList(id).finishTimestamp = System.currentTimeMillis | ||
| executionList(id).state = ExecutionState.CANCELED | ||
| totalRunning -= 1 | ||
|
||
| trimExecutionIfNecessary() | ||
| } | ||
| } | ||
|
|
||
| def onStatementError(id: String, errorMessage: String, errorTrace: String): Unit = { | ||
| synchronized { | ||
| executionList(id).finishTimestamp = System.currentTimeMillis | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -262,11 +262,15 @@ 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() | ||
| logError(s"Error executing query, currentState $currentState, ", e) | ||
| setState(OperationState.ERROR) | ||
| HiveThriftServer2.listener.onStatementError( | ||
| statementId, e.getMessage, SparkUtils.exceptionString(e)) | ||
| throw new HiveSQLException(e.toString) | ||
| if (currentState == OperationState.CANCELED) { | ||
| return | ||
AngersZhuuuu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } else { | ||
| logError(s"Error executing query, currentState $currentState, ", e) | ||
|
||
| setState(OperationState.ERROR) | ||
| HiveThriftServer2.listener.onStatementError( | ||
| statementId, e.getMessage, SparkUtils.exceptionString(e)) | ||
| throw new HiveSQLException(e.toString) | ||
AngersZhuuuu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| setState(OperationState.FINISHED) | ||
| HiveThriftServer2.listener.onStatementFinish(statementId) | ||
|
|
@@ -275,6 +279,7 @@ private[hive] class SparkExecuteStatementOperation( | |
| override def cancel(): Unit = { | ||
| logInfo(s"Cancel '$statement' with $statementId") | ||
| cleanup(OperationState.CANCELED) | ||
| HiveThriftServer2.listener.onStatementCanceled(statementId) | ||
AngersZhuuuu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| private def cleanup(state: OperationState) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.