GitHub user dongjoon-hyun opened a pull request:

    https://github.com/apache/spark/pull/17643

    [SPARK-20345] Fix STS error handling logic on HiveSQLException

    ## What changes were proposed in this pull request?
    
    
[SPARK-5100](https://github.com/apache/spark/commit/343d3bfafd449a0371feb6a88f78e07302fa7143)
 added Spark Thrift Server(STS) UI and the following logic to handle exceptions 
on case `Throwable`.
    
    ```scala
    HiveThriftServer2.listener.onStatementError(
      statementId, e.getMessage, SparkUtils.exceptionString(e))
    ```
    
    However, there occurred a missed case after implementing 
[SPARK-6964](https://github.com/apache/spark/commit/eb19d3f75cbd002f7e72ce02017a8de67f562792)'s
 `Support Cancellation in the Thrift Server` by adding case `HiveSQLException` 
before case `Throwable`.
    
    ```scala
    case e: HiveSQLException =>
      if (getStatus().getState() == OperationState.CANCELED) {
        return
      } else {
        setState(OperationState.ERROR)
        throw e
      }
      // Actually do need to catch Throwable as some failures don't inherit 
from Exception and
      // HiveServer will silently swallow them.
    case e: Throwable =>
      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)
    ```
    
    Logically, we had better add `HiveThriftServer2.listener.onStatementError` 
on case `HiveSQLException`, too.
    
    ## How was this patch tested?
    
    N/A

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-20345

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17643.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17643
    
----
commit cd65ace4784f158760bd0addc41067aeb87c8b27
Author: Dongjoon Hyun <dongj...@apache.org>
Date:   2017-04-15T18:58:30Z

    [SPARK-20345] Fix STS error handling logic on HiveSQLException

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to