Package io.trino.execution
Interface QueryManager
- All Known Implementing Classes:
SqlQueryManager
public interface QueryManager
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddStateChangeListener(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.voidAttempts to fail the query for the specified reason.getFullQueryInfo(QueryId queryId) getQueryInfo(QueryId queryId) getQuerySession(QueryId queryId) getQuerySlug(QueryId queryId) getQueryState(QueryId queryId) getResultQueryInfo(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.booleanvoidoutputTaskFailed(TaskId taskId, Throwable failure) Notify that one of the output tasks failed for a given queryvoidrecordHeartbeat(QueryId queryId) Updates the client heartbeat time, to prevent the query from be automatically purged.voidresultsConsumed(QueryId queryId) Notify that the query results for a query have been fully consumed by the clientvoidsetOutputInfoListener(QueryId queryId, Consumer<QueryExecution.QueryOutputInfo> listener) Add a listener that fires once the query output locations are known.
-
Method Details
-
getQueries
List<BasicQueryInfo> getQueries() -
setOutputInfoListener
void setOutputInfoListener(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
-
outputTaskFailed
Notify that one of the output tasks failed for a given query -
resultsConsumed
Notify that the query results for a query have been fully consumed by the client -
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
- Throws:
NoSuchElementException- if query does not exist
-
getFullQueryInfo
- Throws:
NoSuchElementException- if query does not exist
-
getResultQueryInfo
- Throws:
NoSuchElementException- if query does not exist
-
getQuerySession
- Throws:
NoSuchElementException- if query does not exist
-
getQuerySlug
- Throws:
NoSuchElementException- if query does not exist
-
getQueryState
- Throws:
NoSuchElementException- if query does not exist
-
hasQuery
-
recordHeartbeat
Updates the client heartbeat time, to prevent the query from be automatically purged. If the query does not exist, the call is ignored. -
createQuery
Creates a new query using the specified query execution. -
failQuery
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
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
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.
-