getBuffersByConsumptionPriorityInOrder
public static TreeMap<Integer,List<BufferIndexAndChannel>> getBuffersByConsumptionPriorityInOrder(List<Integer> nextBufferIndexToConsume,
TreeMap<Integer,Deque<BufferIndexAndChannel>> subpartitionToAllBuffers,
int expectedSize)
Calculate and get expected number of buffers with the highest consumption priority. For each
buffer, The greater the difference between next buffer index to consume of subpartition it
belongs to and buffer index, the higher the priority.
- Parameters:
nextBufferIndexToConsume - downstream next buffer index to consume.
subpartitionToAllBuffers - the buffers want to compute priority, are grouped by
subpartitionId.
expectedSize - number of result buffers.
- Returns:
- mapping for subpartitionId to buffers, the value of map entry must be order by
bufferIndex ascending.