use of org.apache.druid.sql.calcite.planner.UnsupportedSQLQueryException in project druid by druid-io.
the class SqlResourceTest method testCannotConvert_UnsupportedSQLQueryException.
/**
* This test is for {@link UnsupportedSQLQueryException} exceptions that are thrown by druid rules during query
* planning. e.g. doing max aggregation on string type. The test checks that the API returns correct error messages
* for such planning errors.
*/
@Test
public void testCannotConvert_UnsupportedSQLQueryException() throws Exception {
// max(string) unsupported
final QueryException exception = doPost(createSimpleQueryWithId("id", "SELECT max(dim1) FROM druid.foo")).lhs;
Assert.assertNotNull(exception);
Assert.assertEquals(PlanningError.UNSUPPORTED_SQL_ERROR.getErrorCode(), exception.getErrorCode());
Assert.assertEquals(PlanningError.UNSUPPORTED_SQL_ERROR.getErrorClass(), exception.getErrorClass());
Assert.assertTrue(exception.getMessage().contains("Cannot build plan for query: SELECT max(dim1) FROM druid.foo. " + "Possible error: Max aggregation is not supported for 'STRING' type"));
checkSqlRequestLog(false);
Assert.assertTrue(lifecycleManager.getAll("id").isEmpty());
}
Aggregations