use of io.trino.server.protocol.Slug.Context.EXECUTING_QUERY in project trino by trinodb.
the class ExecutingStatementResource method getQuery.
protected Query getQuery(QueryId queryId, String slug, long token) {
Query query = queries.get(queryId);
if (query != null) {
if (!query.isSlugValid(slug, token)) {
throw queryNotFound();
}
return query;
}
// this is the first time the query has been accessed on this coordinator
Session session;
Slug querySlug;
try {
session = queryManager.getQuerySession(queryId);
querySlug = queryManager.getQuerySlug(queryId);
if (!querySlug.isValid(EXECUTING_QUERY, slug, token)) {
throw queryNotFound();
}
} catch (NoSuchElementException e) {
throw queryNotFound();
}
query = queries.computeIfAbsent(queryId, id -> Query.create(session, querySlug, queryManager, queryInfoUrlFactory.getQueryInfoUrl(queryId), directExchangeClientSupplier, responseExecutor, timeoutExecutor, blockEncodingSerde));
return query;
}
Aggregations