T - the type of elements in the queue.PQ - type type of sub-queue used for each key-group partition.public class KeyGroupPartitionedPriorityQueue<T,PQ extends InternalPriorityQueue<T> & HeapPriorityQueueElement> extends Object implements InternalPriorityQueue<T>, KeyGroupedInternalPriorityQueue<T>
InternalPriorityQueue is internally partitioned into sub-queues
per key-group and essentially works as a heap-of-heaps. Instances will have set semantics for
elements if the sub-queues have set semantics.| 限定符和类型 | 类和说明 |
|---|---|
static interface |
KeyGroupPartitionedPriorityQueue.PartitionQueueSetFactory<T,PQS extends InternalPriorityQueue<T> & HeapPriorityQueueElement>
Factory that produces the sub-queues that represent the partitions of a
KeyGroupPartitionedPriorityQueue. |
| 构造器和说明 |
|---|
KeyGroupPartitionedPriorityQueue(KeyExtractorFunction<T> keyExtractor,
PriorityComparator<T> elementPriorityComparator,
KeyGroupPartitionedPriorityQueue.PartitionQueueSetFactory<T,PQ> orderedCacheFactory,
KeyGroupRange keyGroupRange,
int totalKeyGroups) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(T toAdd)
Adds the given element to the set, if it is not already contained.
|
void |
addAll(Collection<? extends T> toAdd)
Adds all the given elements to the set.
|
Set<T> |
getSubsetForKeyGroup(int keyGroupId)
Returns the subset of elements in the priority queue that belongs to the given key-group,
within the operator's key-group range.
|
boolean |
isEmpty()
Check if the set contains any elements.
|
org.apache.flink.util.CloseableIterator<T> |
iterator()
Iterator over all elements, no order guaranteed.
|
T |
peek()
Retrieves, but does not remove, the element (w.r.t. order) of this set, or returns
null if this set is empty. |
T |
poll()
Retrieves and removes the first element (w.r.t. the order) of this set, or returns
null if this set is empty. |
boolean |
remove(T toRemove)
Removes the given element from the set, if is contained in the set.
|
int |
size()
Returns the number of elements in this set.
|
public KeyGroupPartitionedPriorityQueue(@Nonnull KeyExtractorFunction<T> keyExtractor, @Nonnull PriorityComparator<T> elementPriorityComparator, @Nonnull KeyGroupPartitionedPriorityQueue.PartitionQueueSetFactory<T,PQ> orderedCacheFactory, @Nonnull KeyGroupRange keyGroupRange, @Nonnegative int totalKeyGroups)
@Nullable public T poll()
InternalPriorityQueuenull if this set is empty.poll 在接口中 InternalPriorityQueue<T>null if this set is empty.@Nullable public T peek()
InternalPriorityQueuenull if this set is empty.peek 在接口中 InternalPriorityQueue<T>null if this set is
empty.public boolean add(@Nonnull T toAdd)
InternalPriorityQueueadd 在接口中 InternalPriorityQueue<T>toAdd - the element to add to the set.true if the operation changed the head element or if it is unclear if
the head element changed. Only returns false if the head element was not
changed by this operation.public boolean remove(@Nonnull T toRemove)
InternalPriorityQueueremove 在接口中 InternalPriorityQueue<T>toRemove - the element to remove.true if the operation changed the head element or if it is unclear if
the head element changed. Only returns false if the head element was not
changed by this operation.public boolean isEmpty()
InternalPriorityQueueisEmpty 在接口中 InternalPriorityQueue<T>public int size()
InternalPriorityQueuesize 在接口中 InternalPriorityQueue<T>public void addAll(@Nullable Collection<? extends T> toAdd)
InternalPriorityQueueaddAll 在接口中 InternalPriorityQueue<T>@Nonnull public org.apache.flink.util.CloseableIterator<T> iterator()
InternalPriorityQueueiterator 在接口中 InternalPriorityQueue<T>@Nonnull public Set<T> getSubsetForKeyGroup(int keyGroupId)
KeyGroupedInternalPriorityQueuegetSubsetForKeyGroup 在接口中 KeyGroupedInternalPriorityQueue<T>Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.