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 JoinFunction<IN1,IN2,OUT> extends Function, Serializable
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 |
---|---|
OUT |
join(IN1 first,
IN2 second)
The join method, called once per joined pair of elements.
|
OUT join(IN1 first, IN2 second) throws Exception
first
- The element from first input.second
- The element from second input.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.