Class OperatorContext

java.lang.Object
io.trino.operator.OperatorContext

public class OperatorContext extends Object
Contains information about Operator execution.

Not thread-safe. Only getNestedOperatorStats() and revocable-memory-related operations are thread-safe.

  • Constructor Details

  • Method Details

    • getOperatorId

      public int getOperatorId()
    • getOperatorType

      public String getOperatorType()
    • getDriverContext

      public DriverContext getDriverContext()
    • getSession

      public Session getSession()
    • 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)
    • setFinishedFuture

      public void setFinishedFuture(com.google.common.util.concurrent.ListenableFuture<Void> finishedFuture)
    • recordWriterInputDataSize

      public void recordWriterInputDataSize(long sizeInBytes)
    • 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()
    • getWriterInputDataSize

      public long getWriterInputDataSize()
    • getPhysicalWrittenDataSize

      public long getPhysicalWrittenDataSize()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNestedOperatorStats

      public List<OperatorStats> getNestedOperatorStats()
    • getOperatorMetrics

      public static Metrics getOperatorMetrics(Metrics operatorMetrics, long inputPositions, double cpuTimeSeconds, double wallTimeSeconds, double blockedWallSeconds)
    • accept

      public <C, R> R accept(QueryContextVisitor<C,R> visitor, C context)
    • getOperatorMemoryContext

      public MemoryTrackingContext getOperatorMemoryContext()