org.apache.druid.query.QueryInterruptedException.getErrorCode()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中org.apache.druid.query.QueryInterruptedException.getErrorCode方法的一些代码示例,展示了QueryInterruptedException.getErrorCode的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryInterruptedException.getErrorCode方法的具体详情如下:
包路径:org.apache.druid.query.QueryInterruptedException
类名称:QueryInterruptedException
方法名:getErrorCode

QueryInterruptedException.getErrorCode介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-druid

private static String getErrorCodeFromThrowable(Throwable e)
{
 if (e instanceof QueryInterruptedException) {
  return ((QueryInterruptedException) e).getErrorCode();
 } else if (e instanceof InterruptedException) {
  return QUERY_INTERRUPTED;
 } else if (e instanceof CancellationException) {
  return QUERY_CANCELLED;
 } else if (e instanceof TimeoutException) {
  return QUERY_TIMEOUT;
 } else if (e instanceof ResourceLimitExceededException) {
  return RESOURCE_LIMIT_EXCEEDED;
 } else {
  return UNKNOWN_EXCEPTION;
 }
}

代码示例来源:origin: apache/incubator-druid

@Test
public void testErrorCode()
{
 Assert.assertEquals(
   "Query cancelled",
   new QueryInterruptedException(new QueryInterruptedException(new CancellationException())).getErrorCode()
 );
 Assert.assertEquals("Query cancelled", new QueryInterruptedException(new CancellationException()).getErrorCode());
 Assert.assertEquals("Query interrupted", new QueryInterruptedException(new InterruptedException()).getErrorCode());
 Assert.assertEquals("Query timeout", new QueryInterruptedException(new TimeoutException()).getErrorCode());
 Assert.assertEquals("Unknown exception", new QueryInterruptedException(null).getErrorCode());
 Assert.assertEquals("Unknown exception", new QueryInterruptedException(new ISE("Something bad!")).getErrorCode());
 Assert.assertEquals(
   "Resource limit exceeded",
   new QueryInterruptedException(new ResourceLimitExceededException("too many!")).getErrorCode()
 );
 Assert.assertEquals(
   "Unknown exception",
   new QueryInterruptedException(new QueryInterruptedException(new ISE("Something bad!"))).getErrorCode()
 );
}

代码示例来源:origin: apache/incubator-druid

@Test
public void testResourceLimitExceeded() throws Exception
{
 final QueryInterruptedException exception = doPost(
   new SqlQuery(
     "SELECT DISTINCT dim1 FROM foo",
     ResultFormat.OBJECT,
     false,
     ImmutableMap.of("maxMergingDictionarySize", 1)
   )
 ).lhs;
 Assert.assertNotNull(exception);
 Assert.assertEquals(exception.getErrorCode(), QueryInterruptedException.RESOURCE_LIMIT_EXCEEDED);
 Assert.assertEquals(exception.getErrorClass(), ResourceLimitExceededException.class.getName());
 checkSqlRequestLog(false);
}

代码示例来源:origin: apache/incubator-druid

@Test
public void testCannotConvert() throws Exception
{
 // SELECT + ORDER unsupported
 final QueryInterruptedException exception = doPost(
   new SqlQuery("SELECT dim1 FROM druid.foo ORDER BY dim1", ResultFormat.OBJECT, false, 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 dim1 FROM druid.foo ORDER BY dim1")
 );
 checkSqlRequestLog(false);
}

代码示例来源:origin: apache/incubator-druid

@Test
public void testCannotValidate() throws Exception
{
 final QueryInterruptedException exception = doPost(
   new SqlQuery(
     "SELECT dim4 FROM druid.foo",
     ResultFormat.OBJECT,
     false,
     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 'dim4' not found in any table"));
 checkSqlRequestLog(false);
}

代码示例来源:origin: apache/incubator-druid

Assert.assertEquals("Query timeout", ((QueryInterruptedException) e.getCause()).getErrorCode());
cause = (QueryInterruptedException) e.getCause();

代码示例来源:origin: apache/incubator-druid

Assert.assertEquals("testing1", actualException.getErrorCode());
Assert.assertEquals("testing2", actualException.getMessage());
Assert.assertEquals(hostName, actualException.getHost());

代码示例来源:origin: apache/incubator-druid

roundTrip(new QueryInterruptedException(new QueryInterruptedException(new CancellationException()))).getErrorCode()
);
Assert.assertEquals(
Assert.assertEquals(
  "Unknown exception",
  roundTrip(new QueryInterruptedException(new ISE("Something bad!"))).getErrorCode()
);
Assert.assertEquals(
  "Unknown exception",
  roundTrip(new QueryInterruptedException(new QueryInterruptedException(new ISE("Something bad!")))).getErrorCode()
);

代码示例来源:origin: org.apache.druid/druid-processing

private static String getErrorCodeFromThrowable(Throwable e)
{
 if (e instanceof QueryInterruptedException) {
  return ((QueryInterruptedException) e).getErrorCode();
 } else if (e instanceof InterruptedException) {
  return QUERY_INTERRUPTED;
 } else if (e instanceof CancellationException) {
  return QUERY_CANCELLED;
 } else if (e instanceof TimeoutException) {
  return QUERY_TIMEOUT;
 } else if (e instanceof ResourceLimitExceededException) {
  return RESOURCE_LIMIT_EXCEEDED;
 } else {
  return UNKNOWN_EXCEPTION;
 }
}

相关文章