IN1
- The data type of the first input data set.IN2
- The data type of the second input data set.O
- The data type of the returned elements.@Public @FunctionalInterface public interface CoGroupFunction<IN1,IN2,O> extends Function, Serializable
The basic syntax for using CoGroup on two data sets is as follows:
DataSet<X> set1 = ...;
DataSet<Y> set2 = ...;
set1.coGroup(set2).where(<key-definition>).equalTo(<key-definition>).with(new MyCoGroupFunction());
set1
is here considered the first input, set2
the second input.
Some keys may only be contained in one of the two original data sets. In that case, the CoGroup function is invoked with in empty input for the side of the data set that did not contain elements with that specific key.
Modifier and Type | Method and Description |
---|---|
void |
coGroup(Iterable<IN1> first,
Iterable<IN2> second,
Collector<O> out)
This method must be implemented to provide a user implementation of a coGroup.
|
void coGroup(Iterable<IN1> first, Iterable<IN2> second, Collector<O> out) throws Exception
first
- The records from the first input.second
- The records from the second.out
- A collector to return elements.Exception
- The function may throw Exceptions, which will cause the program to cancel,
and may trigger the recovery logic.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.