Package io.prestosql.execution
Class QueryStateMachine
- java.lang.Object
-
- io.prestosql.execution.QueryStateMachine
-
@ThreadSafe public class QueryStateMachine extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QueryStateMachine.QueryOutputManager
-
Method Summary
-
-
-
Method Detail
-
begin
public static QueryStateMachine begin(String query, Optional<String> preparedQuery, Session session, URI self, ResourceGroupId resourceGroup, boolean transactionControl, TransactionManager transactionManager, AccessControl accessControl, Executor executor, Metadata metadata, WarningCollector warningCollector, Optional<QueryType> queryType)
Created QueryStateMachines must be transitioned to terminal states to clean up resources.
-
getQueryId
public QueryId getQueryId()
-
getSession
public Session getSession()
-
getPeakUserMemoryInBytes
public long getPeakUserMemoryInBytes()
-
getPeakRevocableMemoryInBytes
public long getPeakRevocableMemoryInBytes()
-
getPeakNonRevocableMemoryInBytes
public long getPeakNonRevocableMemoryInBytes()
-
getPeakTotalMemoryInBytes
public long getPeakTotalMemoryInBytes()
-
getPeakTaskUserMemory
public long getPeakTaskUserMemory()
-
getPeakTaskRevocableMemory
public long getPeakTaskRevocableMemory()
-
getPeakTaskTotalMemory
public long getPeakTaskTotalMemory()
-
getWarningCollector
public WarningCollector getWarningCollector()
-
updateMemoryUsage
public void updateMemoryUsage(long deltaUserMemoryInBytes, long deltaRevocableMemoryInBytes, long deltaTotalMemoryInBytes, long taskUserMemoryInBytes, long taskRevocableMemoryInBytes, long taskTotalMemoryInBytes)
-
getBasicQueryInfo
public BasicQueryInfo getBasicQueryInfo(Optional<BasicStageStats> rootStage)
-
getMemoryPool
public VersionedMemoryPoolId getMemoryPool()
-
setMemoryPool
public void setMemoryPool(VersionedMemoryPoolId memoryPool)
-
addOutputInfoListener
public void addOutputInfoListener(Consumer<QueryExecution.QueryOutputInfo> listener)
-
updateOutputLocations
public void updateOutputLocations(Set<URI> newExchangeLocations, boolean noMoreExchangeLocations)
-
setRoutines
public void setRoutines(List<RoutineInfo> routines)
-
setDynamicFiltersStatsSupplier
public void setDynamicFiltersStatsSupplier(Supplier<DynamicFilterService.DynamicFiltersStats> dynamicFiltersStatsSupplier)
-
setSetCatalog
public void setSetCatalog(String catalog)
-
setSetSchema
public void setSetSchema(String schema)
-
setSetPath
public void setSetPath(String path)
-
getSetPath
public String getSetPath()
-
addSetRole
public void addSetRole(String catalog, SelectedRole role)
-
addResetSessionProperties
public void addResetSessionProperties(String name)
-
removePreparedStatement
public void removePreparedStatement(String key)
-
setStartedTransactionId
public void setStartedTransactionId(TransactionId startedTransactionId)
-
clearTransactionId
public void clearTransactionId()
-
setUpdateType
public void setUpdateType(String updateType)
-
getQueryState
public QueryState getQueryState()
-
isDone
public boolean isDone()
-
transitionToWaitingForResources
public boolean transitionToWaitingForResources()
-
transitionToDispatching
public boolean transitionToDispatching()
-
transitionToPlanning
public boolean transitionToPlanning()
-
transitionToStarting
public boolean transitionToStarting()
-
transitionToRunning
public boolean transitionToRunning()
-
transitionToFinishing
public boolean transitionToFinishing()
-
transitionToFailed
public boolean transitionToFailed(Throwable throwable)
-
transitionToCanceled
public boolean transitionToCanceled()
-
addStateChangeListener
public void addStateChangeListener(StateMachine.StateChangeListener<QueryState> stateChangeListener)
Listener is always notified asynchronously using a dedicated notification thread pool so, care should be taken to avoid leakingthis
when adding a listener in a constructor. Additionally, it is possible notifications are observed out of order due to the asynchronous execution.
-
addQueryInfoStateChangeListener
public void addQueryInfoStateChangeListener(StateMachine.StateChangeListener<QueryInfo> stateChangeListener)
Add a listener for the final query info. This notification is guaranteed to be fired only once. Listener is always notified asynchronously using a dedicated notification thread pool so, care should be taken to avoid leakingthis
when adding a listener in a constructor.
-
getStateChange
public com.google.common.util.concurrent.ListenableFuture<QueryState> getStateChange(QueryState currentState)
-
recordHeartbeat
public void recordHeartbeat()
-
beginAnalysis
public void beginAnalysis()
-
endAnalysis
public void endAnalysis()
-
getCreateTime
public org.joda.time.DateTime getCreateTime()
-
getExecutionStartTime
public Optional<org.joda.time.DateTime> getExecutionStartTime()
-
getLastHeartbeat
public org.joda.time.DateTime getLastHeartbeat()
-
getEndTime
public Optional<org.joda.time.DateTime> getEndTime()
-
getFailureInfo
public Optional<ExecutionFailureInfo> getFailureInfo()
-
pruneQueryInfo
public void pruneQueryInfo()
-
-