[ 
https://issues.apache.org/jira/browse/HIVE-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747701#action_12747701
 ] 

Bill Graham commented on HIVE-795:
----------------------------------

I've got this implemented with better error messaging using the approach 
described above and the message returned is now better. The {{Driver}} response 
codes are pretty coarse though 
(10={{SemanticException}},11={{ParseException}},12={{Unknown}}), so I can't set 
a very good.ANSI SQL-99 SQLState in {{SQLException}}. We have all this info 
known on the server though, so we should tackle this as well.

I propose a few more modifications to support valid SQLStates on the client:

- Extend the {{org.apache.hadoop.hive.ql.parse.ErrorMsg}} {{enum}} to include a 
{{SQLState}} field in addition to the current {{mesg}} string. We'd use the 
SQLStates defined in section 12.5 of 
http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt or possibly borrow 
some the of the sql state extensions used by MySQL.

- Add a {{SQLState}} field to {{HiveServerException}} in addition to the 
{{errorCode}} field.

- When {{HiveServer}} builds the {{HiveServerException}}, it will look up the 
{{SQLCode}} mapped to the exceptions message in the {{ErrorMsg}} enum.

Using {{ErrorMsg}} to couple the message to the sql state isn't the most 
elegant approach, but it's the best way I can thing of transmitting this info 
without refactoring all the places where new exceptions are thrown. Thoughts?

> Return better error messaging from HiveServer 
> ----------------------------------------------
>
>                 Key: HIVE-795
>                 URL: https://issues.apache.org/jira/browse/HIVE-795
>             Project: Hadoop Hive
>          Issue Type: Improvement
>          Components: Server Infrastructure
>            Reporter: Bill Graham
>            Assignee: Bill Graham
>
> If an exception is thrown on the Hive server (i.e., when an invalid query is 
> passed), the Hive server throws a HiveServerExcpeption to the client with a 
> message like "Query returned non-zero code: 10". A more informative 
> description of the cause of the error should be returned.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to