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


Reply via email to