[ 
https://issues.apache.org/jira/browse/SPARK-20345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dongjoon Hyun updated SPARK-20345:
----------------------------------
    Description: 
[SPARK-5100|https://github.com/apache/spark/commit/343d3bfafd449a0371feb6a88f78e07302fa7143]
 added Spark Thrift Server UI and the following logic to handle exceptions on 
case `Throwable`.
{code}
        HiveThriftServer2.listener.onStatementError(
          statementId, e.getMessage, SparkUtils.exceptionString(e))
{code}

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`.

Logically, we had better add `HiveThriftServer2.listener.onStatementError` on 
case `HiveSQLException`, too.
{code}
      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)
{code}

  was:
[SPARK-5100|https://github.com/apache/spark/commit/343d3bfafd449a0371feb6a88f78e07302fa7143]
 added Spark Thrift UI and the following logic to handle exceptions like the 
following on case `Throwable`.
{code}
        HiveThriftServer2.listener.onStatementError(
          statementId, e.getMessage, SparkUtils.exceptionString(e))
{code}

However, there occurs 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`.

Logically, we had better add `HiveThriftServer2.listener.onStatementError` on 
case `HiveSQLException`, too.
{code}
      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)
{code}


> Fix STS error handling logic on HiveSQLException
> ------------------------------------------------
>
>                 Key: SPARK-20345
>                 URL: https://issues.apache.org/jira/browse/SPARK-20345
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.6.3, 2.1.0
>            Reporter: Dongjoon Hyun
>
> [SPARK-5100|https://github.com/apache/spark/commit/343d3bfafd449a0371feb6a88f78e07302fa7143]
>  added Spark Thrift Server UI and the following logic to handle exceptions on 
> case `Throwable`.
> {code}
>         HiveThriftServer2.listener.onStatementError(
>           statementId, e.getMessage, SparkUtils.exceptionString(e))
> {code}
> 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`.
> Logically, we had better add `HiveThriftServer2.listener.onStatementError` on 
> case `HiveSQLException`, too.
> {code}
>       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)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to