java.lang.Object
org.apache.drill.exec.physical.impl.common.SpilledState<T>
Type Parameters:
T - The class holding spilled partition metadata.

Lifecycle

  1. Create a SpilledState instance.
  2. Call initialize(int)
  3. Call addPartition(SpilledPartitionMetadata) (SpilledPartitionMetadata)}, getNextSpilledPartition(), or updateCycle(OperatorStats, SpilledPartitionMetadata, Updater)


public class SpilledState<T extends SpilledPartitionMetadata> extends Object
Manages the spilling information for an operator.
  • Field Details

    • logger

      public static final org.slf4j.Logger logger
  • Constructor Details

    • SpilledState

      public SpilledState()
  • Method Details

    • initialize

      public void initialize(int numPartitions)
      Initializes the number of partitions to use for the spilled state.
      Parameters:
      numPartitions - The number of partitions to use for the spilled state.
    • getNumPartitions

      public int getNumPartitions()
      Gets the number of partitions.
      Returns:
      The number of partitions.
    • isFirstCycle

      public boolean isFirstCycle()
      True if this is the first cycle (0).
      Returns:
      True if this is the first cycle (0).
    • getPartitionMask

      public int getPartitionMask()
    • getBitsInMask

      public int getBitsInMask()
    • addPartition

      public boolean addPartition(T spilledPartition)
      Add the partition metadata to the end of the queue to be processed.
      Parameters:
      spilledPartition - The partition metadata to process.
      Returns:
    • getNextSpilledPartition

      public T getNextSpilledPartition()
      Get the next spilled partition to process.
      Returns:
      The metadata for the next spilled partition to process.
    • isEmpty

      public boolean isEmpty()
      True if there are no spilled partitions.
      Returns:
      True if there are no spilled partitions.
    • updateCycle

      public void updateCycle(OperatorStats operatorStats, T spilledPartition, SpilledState.Updater updater)
      Update the current spill cycle.
      Parameters:
      operatorStats - Current operator stats.
      spilledPartition - The next spilled partition metadata to process.
      updater - The updater implementation that executes custom logic if a spill cycle is incremented.
    • getCycle

      public int getCycle()
      Gets the current spill cycle.
      Returns:
      The current spill cycle.