Package org.apache.flink.runtime.util
Class ReusingKeyGroupedIterator<E>
java.lang.Object
org.apache.flink.runtime.util.ReusingKeyGroupedIterator<E>
- All Implemented Interfaces:
KeyGroupedIterator<E>
The KeyValueIterator returns a key and all values that belong to the key (share the same key).
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionReusingKeyGroupedIterator(org.apache.flink.util.MutableObjectIterator<E> iterator, org.apache.flink.api.common.typeutils.TypeSerializer<E> serializer, org.apache.flink.api.common.typeutils.TypeComparator<E> comparator) Initializes the KeyGroupedIterator. -
Method Summary
-
Constructor Details
-
ReusingKeyGroupedIterator
public ReusingKeyGroupedIterator(org.apache.flink.util.MutableObjectIterator<E> iterator, org.apache.flink.api.common.typeutils.TypeSerializer<E> serializer, org.apache.flink.api.common.typeutils.TypeComparator<E> comparator) Initializes the KeyGroupedIterator. It requires an iterator which returns its result sorted by the key fields.- Parameters:
iterator- An iterator over records, which are sorted by the key fields, in any order.serializer- The serializer for the data type iterated over.comparator- The comparator for the data type iterated over.
-
-
Method Details
-
nextKey
Moves the iterator to the next key. This method may skip any values that have not yet been returned by the iterator created by thegetValues()method. Hence, if called multiple times it "removes" pairs.- Specified by:
nextKeyin interfaceKeyGroupedIterator<E>- Returns:
- true if the input iterator has an other group of key-value pairs that share the same key.
- Throws:
IOException
-
getComparatorWithCurrentReference
-
getCurrent
- Specified by:
getCurrentin interfaceKeyGroupedIterator<E>
-
getValues
Returns an iterator over all values that belong to the current key. The iterator is initiallynull(before the first call tonextKey()and after all keys are consumed. In general, this method returns always a non-null value, if a previous call tonextKey()returntrue.- Specified by:
getValuesin interfaceKeyGroupedIterator<E>- Returns:
- Iterator over all values that belong to the current key.
-