[
https://issues.apache.org/jira/browse/HIVE-26345?focusedWorklogId=784071&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-784071
]
ASF GitHub Bot logged work on HIVE-26345:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Jun/22 07:55
Start Date: 23/Jun/22 07:55
Worklog Time Spent: 10m
Work Description: zhangbutao commented on PR #3393:
URL: https://github.com/apache/hive/pull/3393#issuecomment-1164078451
@zabetak I checked beeline code adn hs2 code, and i still think this change
should be fixed in hs2 side. Here's my test, please correct me if i am wrong.
Thank you.
1. Use following query to test exception message:
`set hive.support.concurrency=false;`
`set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;`
`create table testacid(id int) stored as orc
tblproperties('transactional'='true');`
2. The final result which wraps exception returned from **HS2 side**, a
_**TExecuteStatementResp**_ object
https://github.com/apache/hive/blob/8f1a5b6854daf5fb4814632f9356ef5fe7bb6964/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java#L672-L679
And the final exception massage is set using
_tStatus.setErrorMessage(getMessage());_, that is say client can only get
simplified exception message(**_Error running query_**) instead of full
exception stacktrace:
https://github.com/apache/hive/blob/8f1a5b6854daf5fb4814632f9356ef5fe7bb6964/service/src/java/org/apache/hive/service/cli/HiveSQLException.java#L131
3. The excepton displayed from the **Beeline side**:
Beeline client gets query response (**_TExecuteStatementResp_** object) from
HS2 side, and uses _Utils.verifySuccessWithInfo(execResp.getStatus())_ to check
status or throw exception:
https://github.com/apache/hive/blob/8f1a5b6854daf5fb4814632f9356ef5fe7bb6964/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java#L353-L354
https://github.com/apache/hive/blob/8f1a5b6854daf5fb4814632f9356ef5fe7bb6964/jdbc/src/java/org/apache/hive/jdbc/Utils.java#L378-L383
The final exception message displayed to client is
_status.getErrorMessage()_, that is "**_Error running query_**" returned from
HS2 side:
https://github.com/apache/hive/blob/8f1a5b6854daf5fb4814632f9356ef5fe7bb6964/service/src/java/org/apache/hive/service/cli/HiveSQLException.java#L117-L118
So, i think the root cause was that HS2 side did not return full valid
exception message, and because we often use **_e.getMessage()_** to retrieve
meaningful exception, we should add message content when throw a exception,
e.g.:
`throw new HiveSQLException("Error running query: " + e.toString(), e);`
Issue Time Tracking
-------------------
Worklog Id: (was: 784071)
Time Spent: 0.5h (was: 20m)
> SQLOperation class output real exception message to jdbc client
> ---------------------------------------------------------------
>
> Key: HIVE-26345
> URL: https://issues.apache.org/jira/browse/HIVE-26345
> Project: Hive
> Issue Type: Improvement
> Components: HiveServer2
> Affects Versions: 4.0.0-alpha-2
> Reporter: zhangbutao
> Assignee: zhangbutao
> Priority: Major
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Beeline client may can not get real exception from _*SQLOperation class*_ and
> user may don't how to fix query based on client exception massage.
> Step to repro:
> {code:java}
> set hive.support.concurrency=false;
> set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
> create table testacid(id int) stored as orc
> tblproperties('transactional'='true');{code}
> Beeline console output exception:
> {code:java}
> Error: Error running query (state=,code=0) {code}
>
> However, Hive3 beeline can output readable exception information:
> {code:java}
> Error: Error while compiling statement: FAILED: RuntimeException [Error
> 10264]: To use DbTxnManager you must set hive.support.concurrency=true
> (state=42000,code=10264) {code}
>
> This change was introduced by HIVE-23124, i think we should fix this to
> output real exception to prompt users to amend the query.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)