public abstract class AbstractMergeIterator<T1,T2,O> extends Object implements JoinTaskIterator<T1,T2,O>
Modifier and Type | Field and Description |
---|---|
protected T2 |
blockHeadCopy |
protected T1 |
copy1 |
protected T2 |
copy2 |
protected KeyGroupedIterator<T1> |
iterator1 |
protected KeyGroupedIterator<T2> |
iterator2 |
protected TypePairComparator<T1,T2> |
pairComparator |
protected TypeSerializer<T1> |
serializer1 |
protected TypeSerializer<T2> |
serializer2 |
protected T1 |
spillHeadCopy |
Constructor and Description |
---|
AbstractMergeIterator(MutableObjectIterator<T1> input1,
MutableObjectIterator<T2> input2,
TypeSerializer<T1> serializer1,
TypeComparator<T1> comparator1,
TypeSerializer<T2> serializer2,
TypeComparator<T2> comparator2,
TypePairComparator<T1,T2> pairComparator,
MemoryManager memoryManager,
IOManager ioManager,
int numMemoryPages,
AbstractInvokable parentTask) |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Aborts the matching process.
|
abstract boolean |
callWithNextKey(FlatJoinFunction<T1,T2,O> joinFunction,
Collector<O> collector)
Calls the
JoinFunction#join() method for all two key-value pairs that share the same key and come
from different inputs. |
void |
close()
General-purpose close method.
|
protected abstract <T> T |
createCopy(TypeSerializer<T> serializer,
T value,
T reuse)
Copies an instance of the given type, potentially reusing the object passed as the reuse parameter, which may be null.
|
protected abstract <T> KeyGroupedIterator<T> |
createKeyGroupedIterator(MutableObjectIterator<T> input,
TypeSerializer<T> serializer,
TypeComparator<T> comparator) |
protected void |
crossMatchingGroup(Iterator<T1> values1,
Iterator<T2> values2,
FlatJoinFunction<T1,T2,O> joinFunction,
Collector<O> collector) |
void |
open()
General-purpose open method.
|
protected TypePairComparator<T1,T2> pairComparator
protected KeyGroupedIterator<T1> iterator1
protected KeyGroupedIterator<T2> iterator2
protected final TypeSerializer<T1> serializer1
protected final TypeSerializer<T2> serializer2
protected T1 copy1
protected T1 spillHeadCopy
protected T2 copy2
protected T2 blockHeadCopy
public AbstractMergeIterator(MutableObjectIterator<T1> input1, MutableObjectIterator<T2> input2, TypeSerializer<T1> serializer1, TypeComparator<T1> comparator1, TypeSerializer<T2> serializer2, TypeComparator<T2> comparator2, TypePairComparator<T1,T2> pairComparator, MemoryManager memoryManager, IOManager ioManager, int numMemoryPages, AbstractInvokable parentTask) throws MemoryAllocationException
MemoryAllocationException
public void open() throws IOException
JoinTaskIterator
open
in interface JoinTaskIterator<T1,T2,O>
IOException
- Thrown, if an I/O error occurred while preparing the data. An example is a failing
external sort.public void close()
JoinTaskIterator
close
in interface JoinTaskIterator<T1,T2,O>
public void abort()
JoinTaskIterator
abort
in interface JoinTaskIterator<T1,T2,O>
public abstract boolean callWithNextKey(FlatJoinFunction<T1,T2,O> joinFunction, Collector<O> collector) throws Exception
JoinFunction#join()
method for all two key-value pairs that share the same key and come
from different inputs. The output of the join()
method is forwarded.
This method first zig-zags between the two sorted inputs in order to find a common key, and then calls the join stub with the cross product of the values.
callWithNextKey
in interface JoinTaskIterator<T1,T2,O>
joinFunction
- The match stub containing the match function which is called with the keys.collector
- The collector to pass the match function.Exception
- Forwards all exceptions from the user code and the I/O system.JoinTaskIterator.callWithNextKey(org.apache.flink.api.common.functions.FlatJoinFunction, org.apache.flink.util.Collector)
protected void crossMatchingGroup(Iterator<T1> values1, Iterator<T2> values2, FlatJoinFunction<T1,T2,O> joinFunction, Collector<O> collector) throws Exception
Exception
protected abstract <T> KeyGroupedIterator<T> createKeyGroupedIterator(MutableObjectIterator<T> input, TypeSerializer<T> serializer, TypeComparator<T> comparator)
protected abstract <T> T createCopy(TypeSerializer<T> serializer, T value, T reuse)
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.