Class SpilledState<T extends SpilledPartitionMetadata>
java.lang.Object
org.apache.drill.exec.physical.impl.common.SpilledState<T>
- Type Parameters:
T
- The class holding spilled partition metadata.Lifecycle
- Create a
SpilledState
instance. - Call
initialize(int)
- Call
addPartition(SpilledPartitionMetadata)
(SpilledPartitionMetadata)},getNextSpilledPartition()
, orupdateCycle(OperatorStats, SpilledPartitionMetadata, Updater)
- A user can call
getCycle()
at any time.
- Create a
Manages the spilling information for an operator.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This is a class that is used to do updates of the spilled state. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addPartition
(T spilledPartition) Add the partition metadata to the end of the queue to be processed.int
int
getCycle()
Gets the current spill cycle.Get the next spilled partition to process.int
Gets the number of partitions.int
void
initialize
(int numPartitions) Initializes the number of partitions to use for the spilled state.boolean
isEmpty()
True if there are no spilled partitions.boolean
True if this is the first cycle (0).void
updateCycle
(OperatorStats operatorStats, T spilledPartition, SpilledState.Updater updater) Update the current spill cycle.
-
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
Add the partition metadata to the end of the queue to be processed.- Parameters:
spilledPartition
- The partition metadata to process.- Returns:
-
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.
-