Package io.trino.execution
Class SqlQueryManager
java.lang.Object
io.trino.execution.SqlQueryManager
- All Implemented Interfaces:
QueryManager
-
Constructor Summary
ConstructorsConstructorDescriptionSqlQueryManager(ClusterMemoryManager memoryManager, io.opentelemetry.api.trace.Tracer tracer, QueryManagerConfig queryManagerConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFinalQueryInfoListener(QueryId queryId, StateMachine.StateChangeListener<QueryInfo> stateChangeListener) 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 queryExecution) Creates a new query using the specified query execution.voidAttempts to fail the query for the specified reason.io.airlift.concurrent.ThreadPoolExecutorMBeangetFullQueryInfo(QueryId queryId) io.airlift.concurrent.ThreadPoolExecutorMBeangetQueryInfo(QueryId queryId) getQueryPlan(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.voidstart()voidstop()
-
Constructor Details
-
SqlQueryManager
@Inject public SqlQueryManager(ClusterMemoryManager memoryManager, io.opentelemetry.api.trace.Tracer tracer, QueryManagerConfig queryManagerConfig)
-
-
Method Details
-
start
@PostConstruct public void start() -
stop
@PreDestroy public void stop() -
getQueries
- Specified by:
getQueriesin interfaceQueryManager
-
setOutputInfoListener
public void setOutputInfoListener(QueryId queryId, Consumer<QueryExecution.QueryOutputInfo> listener) Description copied from interface:QueryManagerAdd a listener that fires once the query output locations are known.- Specified by:
setOutputInfoListenerin interfaceQueryManager
-
outputTaskFailed
Description copied from interface:QueryManagerNotify that one of the output tasks failed for a given query- Specified by:
outputTaskFailedin interfaceQueryManager
-
resultsConsumed
Description copied from interface:QueryManagerNotify that the query results for a query have been fully consumed by the client- Specified by:
resultsConsumedin interfaceQueryManager
-
addStateChangeListener
public void addStateChangeListener(QueryId queryId, StateMachine.StateChangeListener<QueryState> listener) Description copied from interface:QueryManagerAdd 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.- Specified by:
addStateChangeListenerin interfaceQueryManager
-
getStateChange
public com.google.common.util.concurrent.ListenableFuture<QueryState> getStateChange(QueryId queryId, QueryState currentState) Description copied from interface:QueryManagerGets 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- Specified by:
getStateChangein interfaceQueryManager
-
getQueryInfo
- Specified by:
getQueryInfoin interfaceQueryManager
-
getFullQueryInfo
- Specified by:
getFullQueryInfoin interfaceQueryManager- Throws:
NoSuchElementException- if query does not exist
-
getResultQueryInfo
- Specified by:
getResultQueryInfoin interfaceQueryManager- Throws:
NoSuchElementException- if query does not exist
-
getQuerySession
- Specified by:
getQuerySessionin interfaceQueryManager- Throws:
NoSuchElementException- if query does not exist
-
getQuerySlug
- Specified by:
getQuerySlugin interfaceQueryManager
-
getQueryPlan
-
addFinalQueryInfoListener
public void addFinalQueryInfoListener(QueryId queryId, StateMachine.StateChangeListener<QueryInfo> stateChangeListener) -
getQueryState
- Specified by:
getQueryStatein interfaceQueryManager
-
hasQuery
- Specified by:
hasQueryin interfaceQueryManager
-
recordHeartbeat
Description copied from interface:QueryManagerUpdates the client heartbeat time, to prevent the query from be automatically purged. If the query does not exist, the call is ignored.- Specified by:
recordHeartbeatin interfaceQueryManager
-
createQuery
Description copied from interface:QueryManagerCreates a new query using the specified query execution.- Specified by:
createQueryin interfaceQueryManager
-
failQuery
Description copied from interface:QueryManagerAttempts 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.- Specified by:
failQueryin interfaceQueryManager
-
cancelQuery
Description copied from interface:QueryManagerAttempts 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.- Specified by:
cancelQueryin interfaceQueryManager
-
cancelStage
Description copied from interface:QueryManagerAttempts 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.- Specified by:
cancelStagein interfaceQueryManager
-
getExecutor
public io.airlift.concurrent.ThreadPoolExecutorMBean getExecutor() -
getManagementExecutor
public io.airlift.concurrent.ThreadPoolExecutorMBean getManagementExecutor() -
getQueryTracker
-