Search in sources :

Example 1 with SqlQuery

use of io.druid.sql.http.SqlQuery in project druid by druid-io.

the class SqlResourceTest method testResourceLimitExceeded.

@Test
public void testResourceLimitExceeded() throws Exception {
    final QueryInterruptedException exception = doPost(new SqlQuery("SELECT DISTINCT dim1 FROM foo", ImmutableMap.<String, Object>of("maxMergingDictionarySize", 1))).lhs;
    Assert.assertNotNull(exception);
    Assert.assertEquals(exception.getErrorCode(), QueryInterruptedException.RESOURCE_LIMIT_EXCEEDED);
    Assert.assertEquals(exception.getErrorClass(), ResourceLimitExceededException.class.getName());
}
Also used : SqlQuery(io.druid.sql.http.SqlQuery) ResourceLimitExceededException(io.druid.query.ResourceLimitExceededException) QueryInterruptedException(io.druid.query.QueryInterruptedException) Test(org.junit.Test)

Example 2 with SqlQuery

use of io.druid.sql.http.SqlQuery in project druid by druid-io.

the class SqlResourceTest method testCannotConvert.

@Test
public void testCannotConvert() throws Exception {
    // TRIM unsupported
    final QueryInterruptedException exception = doPost(new SqlQuery("SELECT TRIM(dim1) FROM druid.foo", null)).lhs;
    Assert.assertNotNull(exception);
    Assert.assertEquals(QueryInterruptedException.UNKNOWN_EXCEPTION, exception.getErrorCode());
    Assert.assertEquals(ISE.class.getName(), exception.getErrorClass());
    Assert.assertTrue(exception.getMessage().contains("Cannot build plan for query: SELECT TRIM(dim1) FROM druid.foo"));
}
Also used : SqlQuery(io.druid.sql.http.SqlQuery) ISE(io.druid.java.util.common.ISE) QueryInterruptedException(io.druid.query.QueryInterruptedException) Test(org.junit.Test)

Example 3 with SqlQuery

use of io.druid.sql.http.SqlQuery in project druid by druid-io.

the class SqlResourceTest method testCannotValidate.

@Test
public void testCannotValidate() throws Exception {
    final QueryInterruptedException exception = doPost(new SqlQuery("SELECT dim3 FROM druid.foo", null)).lhs;
    Assert.assertNotNull(exception);
    Assert.assertEquals(QueryInterruptedException.UNKNOWN_EXCEPTION, exception.getErrorCode());
    Assert.assertEquals(ValidationException.class.getName(), exception.getErrorClass());
    Assert.assertTrue(exception.getMessage().contains("Column 'dim3' not found in any table"));
}
Also used : SqlQuery(io.druid.sql.http.SqlQuery) ValidationException(org.apache.calcite.tools.ValidationException) QueryInterruptedException(io.druid.query.QueryInterruptedException) Test(org.junit.Test)

Aggregations

QueryInterruptedException (io.druid.query.QueryInterruptedException)3 SqlQuery (io.druid.sql.http.SqlQuery)3 Test (org.junit.Test)3 ISE (io.druid.java.util.common.ISE)1 ResourceLimitExceededException (io.druid.query.ResourceLimitExceededException)1 ValidationException (org.apache.calcite.tools.ValidationException)1