/** * It can throw any TajoException if any error occurs. * * @param state * @throws TajoException */ public static void throwIfError(ReturnState state) throws TajoException { if (isError(state)) { throw toTajoException(state); } }
/** * Throw a TajoRuntimeException. It is usually used for unexpected exceptions. * * @param state ReturnState * @return True if no error. */ public static boolean ensureOk(ReturnState state) { if (isError(state)) { throw new TajoRuntimeException(state); } return true; }
public static void throwIfError(ReturnState state) throws SQLException { if (isError(state)) { throw toSQLException(state); } }
/** * It can throw any TajoException if any error occurs. * * @param state * @throws TajoException */ public static void throwIfError(ReturnState state) throws TajoException { if (isError(state)) { throw toTajoException(state); } }
public static void throwIfError(ReturnState state) throws SQLException { if (isError(state)) { throw toSQLException(state); } }
/** * Throw a TajoRuntimeException. It is usually used for unexpected exceptions. * * @param state ReturnState * @return True if no error. */ public static boolean ensureOk(ReturnState state) { if (isError(state)) { throw new TajoRuntimeException(state); } return true; }
/** * If the exception is equivalent to the error corresponding to the expected exception, throws the exception. * It is used to throw an exception for a error. * * @param state ReturnState * @param clazz Exception class corresponding to the expected * @param <T> Exception class * @throws T Exception */ public static <T extends TajoException> void throwsIfThisError(ReturnState state, Class<T> clazz) throws T { if (isError(state)) { T exception = (T) toTajoException(state); if (exception.getClass().equals(clazz)) { throw exception; } } }
/** * If the exception is equivalent to the error corresponding to the expected exception, throws the exception. * It is used to throw an exception for a error. * * @param state ReturnState * @param clazz Exception class corresponding to the expected * @param <T> Exception class * @throws T Exception */ public static <T extends TajoException> void throwsIfThisError(ReturnState state, Class<T> clazz) throws T { if (isError(state)) { T exception = (T) toTajoException(state); if (exception.getClass().equals(clazz)) { throw exception; } } }
if (isError(response.getState())) { StringBuffer errorMessage = new StringBuffer(response.getState().getMessage()); String modifiedMessage;
if (isError(response.getState())) { StringBuffer errorMessage = new StringBuffer(response.getState().getMessage()); String modifiedMessage;
if (ReturnStateUtil.isError(response.getState())) { return ResourcesUtil.createExceptionResponse(LOG, response.getState().getMessage()); } else {
if (ReturnStateUtil.isError(response.getState())) { return ResourcesUtil.createExceptionResponse(LOG, response.getState().getMessage()); } else {
@Test public final void testColumnPartitionedTableWithSmallerExpressions1() throws Exception { ResultSet res = null; String tableName = IdentifierUtil.normalizeIdentifier("testColumnPartitionedTableWithSmallerExpressions1"); res = executeString( "create table " + tableName + " (col1 int4, col2 int4, null_col int4) partition by column(key float8) "); res.close(); assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName)); ClientProtos.SubmitQueryResponse response = client.executeQuery("insert overwrite into " + tableName + " select l_orderkey, l_partkey from lineitem"); assertTrue(ReturnStateUtil.isError(response.getState())); assertEquals(response.getState().getMessage(), "INSERT has smaller expressions than target columns"); res = executeFile("case14.sql"); assertResultSet(res, "case14.result"); res.close(); TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName); verifyPartitionDirectoryFromCatalog(DEFAULT_DATABASE_NAME, tableName, new String[]{"key"}, desc.getStats().getNumRows()); executeString("DROP TABLE " + tableName + " PURGE").close(); }
@Test public final void testColumnPartitionedTableWithSmallerExpressions2() throws Exception { ResultSet res = null; ClientProtos.SubmitQueryResponse response = null; String tableName = IdentifierUtil.normalizeIdentifier("testColumnPartitionedTableWithSmallerExpressions2"); if (nodeType == NodeType.INSERT) { res = executeString( "create table " + tableName + " (col1 int4, col2 int4, null_col int4) partition by column(key float8) "); res.close(); assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName)); response = client.executeQuery("insert overwrite into " + tableName + " select l_returnflag , l_orderkey, l_partkey from lineitem"); assertTrue(ReturnStateUtil.isError(response.getState())); assertEquals(response.getState().getMessage(), "INSERT has smaller expressions than target columns"); res = executeFile("case15.sql"); assertResultSet(res, "case15.result"); res.close(); TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName); verifyPartitionDirectoryFromCatalog(DEFAULT_DATABASE_NAME, tableName, new String[]{"key"}, desc.getStats().getNumRows()); executeString("DROP TABLE " + tableName + " PURGE").close(); } }