Codota Logo
BasicQueryInfo.getErrorCode
Code IndexAdd Codota to your IDE (free)

How to use
getErrorCode
method
in
io.prestosql.server.BasicQueryInfo

Best Java code snippets using io.prestosql.server.BasicQueryInfo.getErrorCode (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: prestosql/presto

private Response failQuery(QueryId queryId, PrestoException queryException)
{
  requireNonNull(queryId, "queryId is null");
  try {
    QueryState state = queryManager.getQueryState(queryId);
    // check before killing to provide the proper error code (this is racy)
    if (state.isDone()) {
      return Response.status(Status.CONFLICT).build();
    }
    queryManager.failQuery(queryId, queryException);
    // verify if the query was failed (if not, we lost the race)
    if (!queryException.getErrorCode().equals(queryManager.getQueryInfo(queryId).getErrorCode())) {
      return Response.status(Status.CONFLICT).build();
    }
    return Response.status(Status.OK).build();
  }
  catch (NoSuchElementException e) {
    return Response.status(Status.GONE).build();
  }
}
origin: io.prestosql/presto-main

private Response failQuery(QueryId queryId, PrestoException queryException)
{
  requireNonNull(queryId, "queryId is null");
  try {
    QueryState state = queryManager.getQueryState(queryId);
    // check before killing to provide the proper error code (this is racy)
    if (state.isDone()) {
      return Response.status(Status.CONFLICT).build();
    }
    queryManager.failQuery(queryId, queryException);
    // verify if the query was failed (if not, we lost the race)
    if (!queryException.getErrorCode().equals(queryManager.getQueryInfo(queryId).getErrorCode())) {
      return Response.status(Status.CONFLICT).build();
    }
    return Response.status(Status.OK).build();
  }
  catch (NoSuchElementException e) {
    return Response.status(Status.GONE).build();
  }
}
origin: prestosql/presto

private void waitForQueryToBeKilled(DistributedQueryRunner queryRunner)
    throws InterruptedException
{
  while (true) {
    for (BasicQueryInfo info : queryRunner.getCoordinator().getQueryManager().getQueries()) {
      if (info.getState().isDone()) {
        assertNotNull(info.getErrorCode());
        assertEquals(info.getErrorCode().getCode(), CLUSTER_OUT_OF_MEMORY.toErrorCode().getCode());
        return;
      }
    }
    MILLISECONDS.sleep(10);
  }
}
origin: prestosql/presto

  @Test(timeOut = 60_000L)
  public void testQueryCpuLimit()
      throws Exception
  {
    try (DistributedQueryRunner queryRunner = builder().setSingleExtraProperty("query.max-cpu-time", "1ms").build()) {
      QueryId queryId = createQuery(queryRunner, TEST_SESSION, "SELECT COUNT(*) FROM lineitem");
      waitForQueryState(queryRunner, queryId, FAILED);
      QueryManager queryManager = queryRunner.getCoordinator().getQueryManager();
      BasicQueryInfo queryInfo = queryManager.getQueryInfo(queryId);
      assertEquals(queryInfo.getState(), FAILED);
      assertEquals(queryInfo.getErrorCode(), EXCEEDED_CPU_LIMIT.toErrorCode());
    }
  }
}
origin: prestosql/presto

private void testRejection()
    throws Exception
{
  try (DistributedQueryRunner queryRunner = createQueryRunner()) {
    queryRunner.installPlugin(new ResourceGroupManagerPlugin());
    queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_dashboard.json")));
    QueryId queryId = createQuery(queryRunner, newRejectionSession(), LONG_LASTING_QUERY);
    waitForQueryState(queryRunner, queryId, FAILED);
    QueryManager queryManager = queryRunner.getCoordinator().getQueryManager();
    assertEquals(queryManager.getQueryInfo(queryId).getErrorCode(), QUERY_REJECTED.toErrorCode());
  }
}
origin: io.prestosql/presto-main

@UsedByGeneratedCode
public void killQuery(String queryId, String message)
{
  QueryId query = parseQueryId(queryId);
  try {
    QueryState state = queryManager.getQueryState(query);
    // check before killing to provide the proper error message (this is racy)
    if (state.isDone()) {
      throw new PrestoException(NOT_SUPPORTED, "Target query is not running: " + queryId);
    }
    queryManager.failQuery(query, createKillQueryException(message));
    // verify if the query was killed (if not, we lost the race)
    if (!ADMINISTRATIVELY_KILLED.toErrorCode().equals(queryManager.getQueryInfo(query).getErrorCode())) {
      throw new PrestoException(NOT_SUPPORTED, "Target query is not running: " + queryId);
    }
  }
  catch (NoSuchElementException e) {
    throw new PrestoException(NOT_FOUND, "Target query not found: " + queryId);
  }
}
origin: prestosql/presto

@UsedByGeneratedCode
public void killQuery(String queryId, String message)
{
  QueryId query = parseQueryId(queryId);
  try {
    QueryState state = queryManager.getQueryState(query);
    // check before killing to provide the proper error message (this is racy)
    if (state.isDone()) {
      throw new PrestoException(NOT_SUPPORTED, "Target query is not running: " + queryId);
    }
    queryManager.failQuery(query, createKillQueryException(message));
    // verify if the query was killed (if not, we lost the race)
    if (!ADMINISTRATIVELY_KILLED.toErrorCode().equals(queryManager.getQueryInfo(query).getErrorCode())) {
      throw new PrestoException(NOT_SUPPORTED, "Target query is not running: " + queryId);
    }
  }
  catch (NoSuchElementException e) {
    throw new PrestoException(NOT_FOUND, "Target query not found: " + queryId);
  }
}
origin: prestosql/presto

assertEquals(basicInfo.getErrorCode(), StandardErrorCode.ABANDONED_QUERY.toErrorCode());
assertEquals(basicInfo.getErrorType(), StandardErrorCode.ABANDONED_QUERY.toErrorCode().getType());
origin: io.prestosql/presto-main

assertEquals(basicInfo.getErrorCode(), StandardErrorCode.ABANDONED_QUERY.toErrorCode());
assertEquals(basicInfo.getErrorType(), StandardErrorCode.ABANDONED_QUERY.toErrorCode().getType());
io.prestosql.serverBasicQueryInfogetErrorCode

Popular methods of BasicQueryInfo

  • getQueryId
  • getState
  • <init>
  • getQueryStats
  • getMemoryPool
  • getQuery
  • getSession
  • getErrorType
  • getResourceGroupId
  • getSelf
  • isScheduled
  • isScheduled

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • setContentView (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now