// 11 - parse error
case 11:
return new BadSqlGrammarException("Hive query", "", new SQLException(cause, sqlState));
// 12 - Internal error
case 12:
return new NonTransientDataAccessResourceException(cause, ex);
// -10000 - another internal error
case -10000:
return new NonTransientDataAccessResourceException(cause, ex);
}
// look at the SQL code
if ("08S01".equals(sqlState)) {
// internal error
return new NonTransientDataAccessResourceException(cause, ex);
}
// generic syntax error
else if ("42000".equals(sqlState)) {
return new BadSqlGrammarException("Hive query", "", new SQLException(cause, sqlState));
}
// not found/already exists
else if ("42S02".equals(sqlState)) {
return new InvalidDataAccessResourceUsageException(cause, ex);
}
// invalid argument
else if ("21000".equals(sqlState)) {
return new BadSqlGrammarException("Hive query", "", new SQLException(cause, sqlState));
}
// use the new Hive 0.10 codes
// https://issues.apache.org/jira/browse/HIVE-3001
// semantic analysis
if (err >= 10000 && err <= 19999) {
return new InvalidDataAccessResourceUsageException(cause, ex);
}
// non transient runtime errors
else if (err >= 20000 && err <= 29999) {
return new DataRetrievalFailureException(cause, ex);
}
// transient error - should retry
else if (err >= 30000 && err <= 39999) {
return new TransientDataAccessResourceException(cause, ex);
}
// internal/unknown errors
else if (err >= 40000 && err <= 49999) {
return new NonTransientDataAccessResourceException(cause, ex);
}
// unknown error
return new NonTransientDataAccessResourceException(cause, ex);
}