Class QueryStateMachine


  • @ThreadSafe
    public class QueryStateMachine
    extends Object
    • Method Detail

      • 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()
      • updateMemoryUsage

        public void updateMemoryUsage​(long deltaUserMemoryInBytes,
                                      long deltaRevocableMemoryInBytes,
                                      long deltaTotalMemoryInBytes,
                                      long taskUserMemoryInBytes,
                                      long taskRevocableMemoryInBytes,
                                      long taskTotalMemoryInBytes)
      • setColumns

        public void setColumns​(List<String> columnNames,
                               List<Type> columnTypes)
      • updateOutputLocations

        public void updateOutputLocations​(Set<URI> newExchangeLocations,
                                          boolean noMoreExchangeLocations)
      • setInputs

        public void setInputs​(List<Input> inputs)
      • setReferencedTables

        public void setReferencedTables​(List<TableInfo> tables)
      • getSetSessionProperties

        public Map<String,​String> getSetSessionProperties()
      • setSetCatalog

        public void setSetCatalog​(String catalog)
      • setSetSchema

        public void setSetSchema​(String schema)
      • setSetPath

        public void setSetPath​(String path)
      • getSetPath

        public String getSetPath()
      • addSetSessionProperties

        public void addSetSessionProperties​(String key,
                                            String value)
      • getResetSessionProperties

        public Set<String> getResetSessionProperties()
      • addResetSessionProperties

        public void addResetSessionProperties​(String name)
      • getAddedPreparedStatements

        public Map<String,​String> getAddedPreparedStatements()
      • getDeallocatedPreparedStatements

        public Set<String> getDeallocatedPreparedStatements()
      • addPreparedStatement

        public void addPreparedStatement​(String key,
                                         String value)
      • 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 leaking this 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 leaking this 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()
      • pruneQueryInfo

        public void pruneQueryInfo()