You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "angerszhu (Jira)" <ji...@apache.org> on 2019/09/21 05:58:00 UTC
[jira] [Comment Edited] (SPARK-29198) Thriftserver throw different
exceptions when disabling spark.sql.hive.thriftServer.async
[ https://issues.apache.org/jira/browse/SPARK-29198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16934940#comment-16934940 ]
angerszhu edited comment on SPARK-29198 at 9/21/19 5:57 AM:
------------------------------------------------------------
Hive JDBC module's problem. ThriftServer will always throw HiveSQLException and convert it to TStatus , then return.
Hive JBDC will always ask run statement in async mode.
When spark thrift server run in sync mode, thrift server will just throw exception when an sql statement come in. then hive jdbc will just got an exception and handle it.
When spark thrift server run in async mode, thrift server will return a operation handle and hive jdbc client will call operation status when operation is not completed, during this process, it will handle exception throw by thrift server when call operation status.
In code ` org.apache.hive.jdbc.HiveStatement.execute()`
{code:java}
try {
TExecuteStatementResp execResp = client.ExecuteStatement(execReq);
Utils.verifySuccessWithInfo(execResp.getStatus());
stmtHandle = execResp.getOperationHandle();
isExecuteStatementFailed = false;
} catch (SQLException eS) {
isExecuteStatementFailed = true;
throw eS;
} catch (Exception ex) {
isExecuteStatementFailed = true;
throw new SQLException(ex.toString(), "08S01", ex);
} finally {
transportLock.unlock();
}
{code}
In async mode, `Utils.verifySuccessWithInfo` will throw HiveSQLException when statement failed.
HiveSQLException will be catch in first catch block since HiveSQLException inherited from SQLException.
`HiveStatement.execut()` will just throw HiveSQLException.
was (Author: angerszhuuu):
It's Hive JDBC module's problem. ThriftServer will always throw HiveSQLException and convert it to TStatus , then return.
Hive JBDC will always ask run statement in async mode.
When spark thrift server run in sync mode, thrift server will just throw exception when an sql statement come in. then hive jdbc will just got an exception and handle it.
When spark thrift server run in async mode, thrift server will return a operation handle and hive jdbc client will call operation status when operation is not completed, during this process, it will handle exception throw by thrift server when call operation status.
when async = false in code ` org.apache.hive.jdbc.HiveStatement.execute()`
{code:java}
try {
TExecuteStatementResp execResp = client.ExecuteStatement(execReq);
Utils.verifySuccessWithInfo(execResp.getStatus());
stmtHandle = execResp.getOperationHandle();
isExecuteStatementFailed = false;
} catch (SQLException eS) {
isExecuteStatementFailed = true;
throw eS;
} catch (Exception ex) {
isExecuteStatementFailed = true;
throw new SQLException(ex.toString(), "08S01", ex);
} finally {
transportLock.unlock();
}
{code}
`Utils.verifySuccessWithInfo` will throw HiveSQLException when statement failed.
HiveSQLException will be catch in first catch block since HiveSQLException inherited from SQLException.
`HiveStatement.execut()` will just throw HiveSQLException.
> Thriftserver throw different exceptions when disabling spark.sql.hive.thriftServer.async
> ----------------------------------------------------------------------------------------
>
> Key: SPARK-29198
> URL: https://issues.apache.org/jira/browse/SPARK-29198
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.0.0
> Reporter: Yuming Wang
> Priority: Major
>
> How to reproduce:
> {code:scala}
> test("Verify thriftserver exceptions") {
> withJdbcStatement() {statement =>
> statement.executeQuery("set spark.sql.hive.thriftServer.async=true")
> Thread.sleep(1000)
> intercept[SQLException] {
> statement.executeQuery("SELECT * from not-exist")
> }
> statement.executeQuery("set spark.sql.hive.thriftServer.async=false")
> Thread.sleep(1000)
> intercept[org.apache.hive.service.cli.HiveSQLException] {
> statement.executeQuery("SELECT * from not-exist")
> }
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org