Package io.trino.execution
Class SqlStage
java.lang.Object
io.trino.execution.SqlStage
This class is merely a container used by coordinator to track tasks for a single stage.
It is designed to keep track of execution statistics for tasks from the same stage as well as aggregating them and providing a final stage info when the stage execution is completed.
This class doesn't imply anything about the nature of execution. It is not responsible for scheduling tasks in a certain order, gang scheduling or any other execution primitives.
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()voidaddFinalStageInfoListener(StateMachine.StateChangeListener<StageInfo> stateChangeListener) Add a listener for the final stage info.static SqlStagecreateSqlStage(StageId stageId, PlanFragment fragment, Map<PlanNodeId, TableInfo> tables, RemoteTaskFactory remoteTaskFactory, Session session, boolean summarizeTaskInfo, NodeTaskMap nodeTaskMap, Executor stateMachineExecutor, io.opentelemetry.api.trace.Tracer tracer, io.opentelemetry.api.trace.Span schedulerSpan, SplitSchedulerStats schedulerStats) createTask(InternalNode node, int partition, int attempt, Optional<int[]> bucketToPartition, OutputBuffers outputBuffers, com.google.common.collect.Multimap<PlanNodeId, Split> splits, Set<PlanNodeId> noMoreSplits, Optional<io.airlift.units.DataSize> estimatedMemory, boolean speculative) voidvoidfailTaskRemotely(TaskId taskId, Throwable failureCause) voidfinish()io.opentelemetry.api.trace.SpangetState()io.airlift.units.DurationlonglongvoidrecordGetSplitTime(long start) toString()
-
Method Details
-
createSqlStage
public static SqlStage createSqlStage(StageId stageId, PlanFragment fragment, Map<PlanNodeId, TableInfo> tables, RemoteTaskFactory remoteTaskFactory, Session session, boolean summarizeTaskInfo, NodeTaskMap nodeTaskMap, Executor stateMachineExecutor, io.opentelemetry.api.trace.Tracer tracer, io.opentelemetry.api.trace.Span schedulerSpan, SplitSchedulerStats schedulerStats) -
getStageId
-
getStageSpan
public io.opentelemetry.api.trace.Span getStageSpan() -
getState
-
finish
public void finish() -
abort
public void abort() -
fail
-
failTaskRemotely
-
addFinalStageInfoListener
public void addFinalStageInfoListener(StateMachine.StateChangeListener<StageInfo> stateChangeListener) Add a listener for the final stage 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 leakingthiswhen adding a listener in a constructor. Additionally, it is possible notifications are observed out of order due to the asynchronous execution. -
getFragment
-
getUserMemoryReservation
public long getUserMemoryReservation() -
getTotalMemoryReservation
public long getTotalMemoryReservation() -
getTotalCpuTime
public io.airlift.units.Duration getTotalCpuTime() -
getBasicStageStats
-
getStageInfo
-
getBasicStageInfo
-
createTask
public Optional<RemoteTask> createTask(InternalNode node, int partition, int attempt, Optional<int[]> bucketToPartition, OutputBuffers outputBuffers, com.google.common.collect.Multimap<PlanNodeId, Split> splits, Set<PlanNodeId> noMoreSplits, Optional<io.airlift.units.DataSize> estimatedMemory, boolean speculative) -
recordGetSplitTime
public void recordGetSplitTime(long start) -
toString
-