IN1
- The type of the elements in the first input.IN2
- The type of the elements in the second input.OUT
- The type of the result elements.@Public @FunctionalInterface public interface FlatJoinFunction<IN1,IN2,OUT> extends Function, Serializable
This particular variant of the join function supports to return zero, one, or more result values per pair of joining values.
By default, the joins follows strictly the semantics of an "inner join" in SQL. the semantics are those of an "inner join", meaning that elements are filtered out if their key is not contained in the other data set.
The basic syntax for using Join on two data sets is as follows:
DataSet<X> set1 = ...;
DataSet<Y> set2 = ...;
set1.join(set2).where(<key-definition>).equalTo(<key-definition>).with(new MyJoinFunction());
set1
is here considered the first input, set2
the second input.
The Join function is an optional part of a join operation. If no JoinFunction is provided, the result of the operation is a sequence of 2-tuples, where the elements in the tuple are those that the JoinFunction would have been invoked with.
Note: You can use a CoGroupFunction
to perform an outer join.
Modifier and Type | Method and Description |
---|---|
void |
join(IN1 first,
IN2 second,
Collector<OUT> out)
The join method, called once per joined pair of elements.
|
void join(IN1 first, IN2 second, Collector<OUT> out) throws Exception
first
- The element from first input.second
- The element from second input.out
- The collector used to return zero, one, or more elements.Exception
- This method may throw exceptions. Throwing an exception will cause the
operation to fail and may trigger recovery.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.