Package io.trino.operator
Class OperatorContext
- java.lang.Object
-
- io.trino.operator.OperatorContext
-
public class OperatorContext extends Object
Contains information aboutOperatorexecution.Not thread-safe. Only
getNestedOperatorStats()and revocable-memory-related operations are thread-safe.
-
-
Constructor Summary
Constructors Constructor Description OperatorContext(int operatorId, PlanNodeId planNodeId, String operatorType, DriverContext driverContext, Executor executor, MemoryTrackingContext operatorMemoryContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <C,R>
Raccept(QueryContextVisitor<C,R> visitor, C context)AggregatedMemoryContextaggregateRevocableMemoryContext()AggregatedMemoryContextaggregateUserMemoryContext()voiddestroy()static MetricsgetConnectorMetrics(Metrics connectorMetrics, long physicalInputReadTimeNanos)DriverContextgetDriverContext()io.airlift.stats.CounterStatgetInputDataSize()io.airlift.stats.CounterStatgetInputPositions()List<OperatorStats>getNestedOperatorStats()intgetOperatorId()MemoryTrackingContextgetOperatorMemoryContext()static MetricsgetOperatorMetrics(Metrics operatorMetrics, long inputPositions)StringgetOperatorType()io.airlift.stats.CounterStatgetOutputDataSize()io.airlift.stats.CounterStatgetOutputPositions()longgetPhysicalWrittenDataSize()longgetReservedRevocableBytes()SessiongetSession()SpillContextgetSpillContext()booleanisDone()booleanisMemoryRevokingRequested()com.google.common.util.concurrent.ListenableFuture<Void>isWaitingForMemory()com.google.common.util.concurrent.ListenableFuture<Void>isWaitingForRevocableMemory()LocalMemoryContextlocalRevocableMemoryContext()LocalMemoryContextlocalUserMemoryContext()AggregatedMemoryContextnewAggregateRevocableMemoryContext()AggregatedMemoryContextnewAggregateUserMemoryContext()LocalMemoryContextnewLocalUserMemoryContext(String allocationTag)voidrecordBlocked(com.google.common.util.concurrent.ListenableFuture<Void> blocked)voidrecordDynamicFilterSplitProcessed(long dynamicFilterSplits)voidrecordNetworkInput(long sizeInBytes, long positions)Record the amount of network bytes that were read by an operator.voidrecordOutput(long sizeInBytes, long positions)voidrecordPhysicalInputWithTiming(long sizeInBytes, long positions, long readNanos)Record the amount of physical bytes that were read by an operator and the time it took to read the data.voidrecordPhysicalWrittenData(long sizeInBytes)voidrecordProcessedInput(long sizeInBytes, long positions)Record the size in bytes of input blocks that were processed by an operator.longrequestMemoryRevoking()Returns how much revocable memory will be revoked by the operatorvoidresetMemoryRevokingRequested()voidsetInfoSupplier(Supplier<? extends OperatorInfo> infoSupplier)voidsetLatestConnectorMetrics(Metrics metrics)voidsetLatestMetrics(Metrics metrics)Overwrites the metrics with the latest one.voidsetMemoryRevocationRequestListener(Runnable listener)voidsetNestedOperatorStatsSupplier(Supplier<List<OperatorStats>> nestedOperatorStatsSupplier)StringtoString()
-
-
-
Constructor Detail
-
OperatorContext
public OperatorContext(int operatorId, PlanNodeId planNodeId, String operatorType, DriverContext driverContext, Executor executor, MemoryTrackingContext operatorMemoryContext)
-
-
Method Detail
-
getOperatorId
public int getOperatorId()
-
getOperatorType
public String getOperatorType()
-
getDriverContext
public DriverContext getDriverContext()
-
getSession
public Session getSession()
-
isDone
public boolean isDone()
-
recordPhysicalInputWithTiming
public void recordPhysicalInputWithTiming(long sizeInBytes, long positions, long readNanos)Record the amount of physical bytes that were read by an operator and the time it took to read the data. This metric is valid only for source operators.
-
recordNetworkInput
public void recordNetworkInput(long sizeInBytes, long positions)Record the amount of network bytes that were read by an operator. This metric is valid only for source operators.
-
recordProcessedInput
public void recordProcessedInput(long sizeInBytes, long positions)Record the size in bytes of input blocks that were processed by an operator. This metric is valid only for source operators.
-
recordOutput
public void recordOutput(long sizeInBytes, long positions)
-
recordDynamicFilterSplitProcessed
public void recordDynamicFilterSplitProcessed(long dynamicFilterSplits)
-
setLatestMetrics
public void setLatestMetrics(Metrics metrics)
Overwrites the metrics with the latest one.- Parameters:
metrics- Latest operator's metrics.
-
setLatestConnectorMetrics
public void setLatestConnectorMetrics(Metrics metrics)
-
recordPhysicalWrittenData
public void recordPhysicalWrittenData(long sizeInBytes)
-
recordBlocked
public void recordBlocked(com.google.common.util.concurrent.ListenableFuture<Void> blocked)
-
isWaitingForMemory
public com.google.common.util.concurrent.ListenableFuture<Void> isWaitingForMemory()
-
isWaitingForRevocableMemory
public com.google.common.util.concurrent.ListenableFuture<Void> isWaitingForRevocableMemory()
-
newLocalUserMemoryContext
public LocalMemoryContext newLocalUserMemoryContext(String allocationTag)
-
localUserMemoryContext
public LocalMemoryContext localUserMemoryContext()
-
localRevocableMemoryContext
public LocalMemoryContext localRevocableMemoryContext()
-
aggregateUserMemoryContext
public AggregatedMemoryContext aggregateUserMemoryContext()
-
aggregateRevocableMemoryContext
public AggregatedMemoryContext aggregateRevocableMemoryContext()
-
newAggregateUserMemoryContext
public AggregatedMemoryContext newAggregateUserMemoryContext()
-
newAggregateRevocableMemoryContext
public AggregatedMemoryContext newAggregateRevocableMemoryContext()
-
getReservedRevocableBytes
public long getReservedRevocableBytes()
-
destroy
public void destroy()
-
getSpillContext
public SpillContext getSpillContext()
-
isMemoryRevokingRequested
public boolean isMemoryRevokingRequested()
-
requestMemoryRevoking
public long requestMemoryRevoking()
Returns how much revocable memory will be revoked by the operator
-
resetMemoryRevokingRequested
public void resetMemoryRevokingRequested()
-
setMemoryRevocationRequestListener
public void setMemoryRevocationRequestListener(Runnable listener)
-
setInfoSupplier
public void setInfoSupplier(Supplier<? extends OperatorInfo> infoSupplier)
-
setNestedOperatorStatsSupplier
public void setNestedOperatorStatsSupplier(Supplier<List<OperatorStats>> nestedOperatorStatsSupplier)
-
getInputDataSize
public io.airlift.stats.CounterStat getInputDataSize()
-
getInputPositions
public io.airlift.stats.CounterStat getInputPositions()
-
getOutputDataSize
public io.airlift.stats.CounterStat getOutputDataSize()
-
getOutputPositions
public io.airlift.stats.CounterStat getOutputPositions()
-
getPhysicalWrittenDataSize
public long getPhysicalWrittenDataSize()
-
getNestedOperatorStats
public List<OperatorStats> getNestedOperatorStats()
-
getOperatorMetrics
public static Metrics getOperatorMetrics(Metrics operatorMetrics, long inputPositions)
-
getConnectorMetrics
public static Metrics getConnectorMetrics(Metrics connectorMetrics, long physicalInputReadTimeNanos)
-
accept
public <C,R> R accept(QueryContextVisitor<C,R> visitor, C context)
-
getOperatorMemoryContext
public MemoryTrackingContext getOperatorMemoryContext()
-
-