Package io.trino.execution
Interface QueryManager
-
- All Known Implementing Classes:
SqlQueryManager
public interface QueryManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddOutputInfoListener(QueryId queryId, Consumer<QueryExecution.QueryOutputInfo> listener)Add a listener that fires once the query output locations are known.voidaddStateChangeListener(QueryId queryId, StateMachine.StateChangeListener<QueryState> listener)Add a listener that fires each time the query state changes.voidcancelQuery(QueryId queryId)Attempts to fail the query due to a user cancellation.voidcancelStage(StageId stageId)Attempts to cancel the stage and continue the query.voidcreateQuery(QueryExecution execution)Creates a new query using the specified query execution.voidfailQuery(QueryId queryId, Throwable cause)Attempts to fail the query for the specified reason.QueryInfogetFullQueryInfo(QueryId queryId)List<BasicQueryInfo>getQueries()BasicQueryInfogetQueryInfo(QueryId queryId)SessiongetQuerySession(QueryId queryId)SluggetQuerySlug(QueryId queryId)QueryStategetQueryState(QueryId queryId)com.google.common.util.concurrent.ListenableFuture<QueryState>getStateChange(QueryId queryId, QueryState currentState)Gets a future that completes when the query changes from the specified current state or immediately if the query is already in a final state.voidrecordHeartbeat(QueryId queryId)Updates the client heartbeat time, to prevent the query from be automatically purged.
-
-
-
Method Detail
-
getQueries
List<BasicQueryInfo> getQueries()
-
addOutputInfoListener
void addOutputInfoListener(QueryId queryId, Consumer<QueryExecution.QueryOutputInfo> listener) throws NoSuchElementException
Add a listener that fires once the query output locations are known.- Throws:
NoSuchElementException- if query does not exist
-
addStateChangeListener
void addStateChangeListener(QueryId queryId, StateMachine.StateChangeListener<QueryState> listener) throws NoSuchElementException
Add a listener that fires each time the query state changes. Listener is always notified asynchronously using a dedicated notification thread pool so, care should be taken to avoid leakingthiswhen adding a listener in a constructor. Additionally, it is possible notifications are observed out of order due to the asynchronous execution.- Throws:
NoSuchElementException- if query does not exist
-
getStateChange
com.google.common.util.concurrent.ListenableFuture<QueryState> getStateChange(QueryId queryId, QueryState currentState)
Gets a future that completes when the query changes from the specified current state or immediately if the query is already in a final state. If the query does not exist, the future will contain aNoSuchElementException
-
getQueryInfo
BasicQueryInfo getQueryInfo(QueryId queryId) throws NoSuchElementException
- Throws:
NoSuchElementException- if query does not exist
-
getFullQueryInfo
QueryInfo getFullQueryInfo(QueryId queryId) throws NoSuchElementException
- Throws:
NoSuchElementException- if query does not exist
-
getQuerySession
Session getQuerySession(QueryId queryId)
- Throws:
NoSuchElementException- if query does not exist
-
getQuerySlug
Slug getQuerySlug(QueryId queryId)
- Throws:
NoSuchElementException- if query does not exist
-
getQueryState
QueryState getQueryState(QueryId queryId) throws NoSuchElementException
- Throws:
NoSuchElementException- if query does not exist
-
recordHeartbeat
void recordHeartbeat(QueryId queryId)
Updates the client heartbeat time, to prevent the query from be automatically purged. If the query does not exist, the call is ignored.
-
createQuery
void createQuery(QueryExecution execution)
Creates a new query using the specified query execution.
-
failQuery
void failQuery(QueryId queryId, Throwable cause)
Attempts to fail the query for the specified reason. If the query is already in a final state, the call is ignored. If the query does not exist, the call is ignored.
-
cancelQuery
void cancelQuery(QueryId queryId)
Attempts to fail the query due to a user cancellation. If the query is already in a final state, the call is ignored. If the query does not exist, the call is ignored.
-
cancelStage
void cancelStage(StageId stageId)
Attempts to cancel the stage and continue the query. If the stage is already in a final state, the call is ignored. If the query does not exist, the call is ignored.
-
-