You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Wataru Yukawa (JIRA)" <ji...@apache.org> on 2012/05/20 10:36:41 UTC

[jira] [Commented] (HIVE-2661) ErrorCode and SQLStates list

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

Wataru Yukawa commented on HIVE-2661:
-------------------------------------


Error Codes & Messages are organaized in https://issues.apache.org/jira/browse/HIVE-3001

It's fine!

but, there is unprocessed code.

for example,

Driver.java
{noformat}
      // TODO: do better with handling types of Exception here
      errorMessage = "FAILED: Hive Internal Error: " + Utilities.getNameMessage(e);
      SQLState = "08S01";
      console.printError(errorMessage + "\n"
          + org.apache.hadoop.util.StringUtils.stringifyException(e));
      return (12);
    } finally {
{noformat}

And, SQLState "08S01" is hard coded.

for example,
HiveConnection.java
{noformat}
  public HiveConnection(HiveConf hiveConf) throws SQLException {
    try {
      client = new HiveServer.HiveServerHandler(hiveConf);
    } catch (MetaException e) {
      throw new SQLException("Error accessing Hive metastore: "
          + e.getMessage(), "08S01",e);
    }
    isClosed = false;
    configureConnection();
  }
{noformat}

I'm glad if this is processed.

Thanks.
                
> ErrorCode and SQLStates list
> ----------------------------
>
>                 Key: HIVE-2661
>                 URL: https://issues.apache.org/jira/browse/HIVE-2661
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Processor
>            Reporter: Wataru Yukawa
>
> If there is the errorCode and SQLStates list, I think that many developers are more happy.
> example:
> http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-error-sqlstates.html
> But now errorCode is hard coded in the following example.
> Driver.java
> {noformat}
>     } catch (SemanticException e) {
>       errorMessage = "FAILED: Error in semantic analysis: " + e.getMessage();
>       SQLState = ErrorMsg.findSQLState(e.getMessage());
>       console.printError(errorMessage, "\n"
>           + org.apache.hadoop.util.StringUtils.stringifyException(e));
>       return (10);
>     } catch (ParseException e) {
>       errorMessage = "FAILED: Parse Error: " + e.getMessage();
>       SQLState = ErrorMsg.findSQLState(e.getMessage());
>       console.printError(errorMessage, "\n"
>           + org.apache.hadoop.util.StringUtils.stringifyException(e));
>       return (11);
>     } catch (Exception e) {
>       errorMessage = "FAILED: Hive Internal Error: " + Utilities.getNameMessage(e);
>       SQLState = ErrorMsg.findSQLState(e.getMessage());
>       console.printError(errorMessage + "\n"
>           + org.apache.hadoop.util.StringUtils.stringifyException(e));
>       return (12);
>     } finally {
>       perfLogger.PerfLogEnd(LOG, PerfLogger.COMPILE);
>       restoreSession(queryState);
>     }
> {noformat}
> So, for example, automatic generation of the following table is difficult.
> ||errorCode||error message||SQLState||
> |10|FAILED: Error in semantic analysis|42S02|
> |11|FAILED: Parse Error|42000|
> So, I think that refactoring to unify management of errorCode and SQLStates using enum or constant class is good.
> I am glad when it is inquired. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira