protected HiveSQLException toSQLException(String prefix, CommandProcessorResponse response) { HiveSQLException ex = new HiveSQLException(prefix + ": " + response.getErrorMessage(), response.getSQLState(), response.getResponseCode()); if (response.getException() != null) { ex.initCause(response.getException()); } return ex; }
CommandProcessorResponse cpr = driver.run(query); if (cpr.getResponseCode() != 0) { LOG.error("Failed to run " + query, cpr.getException()); throw new HiveException("Failed to run " + query, cpr.getException());
@Test public void testMergeNegative2() throws Exception { CommandProcessorResponse cpr = runStatementOnDriverNegative("MERGE INTO "+ Table.ACIDTBL + " target USING " + Table.NONACIDORCTBL + "\n source ON target.pk = source.pk " + "\nWHEN MATCHED THEN UPDATE set b = 1 " + "\nWHEN MATCHED THEN UPDATE set b=a"); Assert.assertEquals(ErrorMsg.MERGE_TOO_MANY_UPDATE, ((HiveException)cpr.getException()).getCanonicalErrorMsg()); }
@Test public void testSetClauseFakeColumn() throws Exception { CommandProcessorResponse cpr = runStatementOnDriverNegative("MERGE INTO "+ Table.ACIDTBL + " target USING " + Table.NONACIDORCTBL + "\n source ON target.a = source.a " + "\nWHEN MATCHED THEN UPDATE set t = 1"); Assert.assertEquals(ErrorMsg.INVALID_TARGET_COLUMN_IN_SET_CLAUSE, ((HiveException)cpr.getException()).getCanonicalErrorMsg()); cpr = runStatementOnDriverNegative("update " + Table.ACIDTBL + " set t = 1"); Assert.assertEquals(ErrorMsg.INVALID_TARGET_COLUMN_IN_SET_CLAUSE, ((HiveException)cpr.getException()).getCanonicalErrorMsg()); } @Test
@Test public void testMergeNegative() throws Exception { CommandProcessorResponse cpr = runStatementOnDriverNegative("MERGE INTO " + Table.ACIDTBL + " target USING " + Table.NONACIDORCTBL + " source\nON target.a = source.a " + "\nWHEN MATCHED THEN UPDATE set b = 1 " + "\nWHEN MATCHED THEN DELETE " + "\nWHEN NOT MATCHED AND a < 1 THEN INSERT VALUES(1,2)"); Assert.assertEquals(ErrorMsg.MERGE_PREDIACTE_REQUIRED, ((HiveException)cpr.getException()).getCanonicalErrorMsg()); } @Test
assertEquals(ret.getResponseCode() + ":" + ret.getErrorMessage(), null, ret.getException()); assertEquals(ret2.getResponseCode() + ":" + ret2.getErrorMessage(), null, ret2.getException());
CommandProcessorResponse cpr = driver.compileAndRespond(query); if (cpr.getResponseCode() != 0) { throw new HiveException("Failed to compile query: " + cpr.getException()); throw new HiveException("Failed to create temp table: " + cpr.getException()); cpr = driver.compileAndRespond(query); if(cpr.getResponseCode() != 0) { throw new HiveException("Failed to create temp table: "+cpr.getException());
"LOAD DATA LOCAL INPATH '"+tempLocation+"' OVERWRITE INTO TABLE "+ dbName+ "." + tableName ); assertEquals(ret.getResponseCode() + ":" + ret.getErrorMessage(), null, ret.getException()); null, selectRet.getException()); assertEquals(ret2.getResponseCode() + ":" + ret2.getErrorMessage(), null, ret2.getException()); assertEquals(ret3.getResponseCode() + ":" + ret3.getErrorMessage(), null, ret3.getException()); null, selectRet2.getException());
driver.run("ALTER TABLE test_table SET FILEFORMAT parquet").getResponseCode()); Throwable exception = driver.run( "SELECT * FROM test_table ORDER BY key LIMIT 10").getException(); Assert.assertTrue(exception instanceof HiveException); Assert.assertTrue(exception.getMessage().contains("Spark job failed due to task failures"));
"LOAD DATA LOCAL INPATH '"+tempLocation+"' OVERWRITE INTO TABLE "+ dbName+ "." + tableName ); assertEquals(ret.getResponseCode() + ":" + ret.getErrorMessage(), null, ret.getException()); null, selectRet.getException()); assertEquals(ret2.getResponseCode() + ":" + ret2.getErrorMessage(), null, ret2.getException()); assertEquals(ret3.getResponseCode() + ":" + ret3.getErrorMessage(), null, ret3.getException()); null, selectRet2.getException());
CommandProcessorResponse cpr = driver.compileAndRespond(query, false); if (cpr.getResponseCode() != 0) { throw new HiveException("Failed to compile query: " + cpr.getException()); throw new HiveException("Failed to create temp table: " + cpr.getException()); cpr = driver.compileAndRespond(query, true); if(cpr.getResponseCode() != 0) { throw new HiveException("Failed to create temp table: "+cpr.getException());
throw new SemanticException(ret.getErrorMessage(), ret.getException());
throw new SemanticException(ret.getErrorMessage(), ret.getException());
SessionState.getConsole().printError(response.toString(), response.getException() != null ? Throwables.getStackTraceAsString(response.getException()) : "");
protected HiveSQLException toSQLException(String prefix, CommandProcessorResponse response) { HiveSQLException ex = new HiveSQLException(prefix + ": " + response.getErrorMessage(), response.getSQLState(), response.getResponseCode()); if (response.getException() != null) { ex.initCause(response.getException()); } return ex; } }
protected HiveSQLException toSQLException(String prefix, CommandProcessorResponse response) { HiveSQLException ex = new HiveSQLException(prefix + ": " + response.getErrorMessage(), response.getSQLState(), response.getResponseCode()); if (response.getException() != null) { ex.initCause(response.getException()); } return ex; } }
protected HiveSQLException toSQLException(String prefix, CommandProcessorResponse response) { HiveSQLException ex = new HiveSQLException(prefix + ": " + response.getErrorMessage(), response.getSQLState(), response.getResponseCode()); if (response.getException() != null) { ex.initCause(response.getException()); } return ex; } }
protected HiveSQLException toSQLException(String prefix, CommandProcessorResponse response) { HiveSQLException ex = new HiveSQLException(prefix + ": " + response.getErrorMessage(), response.getSQLState(), response.getResponseCode()); if (response.getException() != null) { ex.initCause(response.getException()); } return ex; } }
protected HiveSQLException toSQLException(String prefix, CommandProcessorResponse response) { HiveSQLException ex = new HiveSQLException(prefix + ": " + response.getErrorMessage(), response.getSQLState(), response.getResponseCode()); if (response.getException() != null) { ex.initCause(response.getException()); } return ex; }