Reputation: 6342
The following code snippet is copied from javadoc of JoinedStreams
val one: DataStream[(String, Int)] = ...
val two: DataStream[(String, Int)] = ...
val result = one.join(two)
.where {t => ... }
.equal {t => ... }
.window(TumblingEventTimeWindows.of(Time.of(5, TimeUnit.SECONDS)))
.apply(new MyJoinFunction())
The two streams are joined based on only one key (computed through t => ...
), eg, one.a = two.a
,
I would ask how I could do the join based on more than one key, eg, one.a = two.a and one.b = two.b
Upvotes: 0
Views: 189
Reputation: 43707
Your key selectors can return a Tuple, i.e.,
.where {t => (t.a, t.b)}
.equals {t => (t.a, t.b)}
Upvotes: 1
Reputation: 1009
By using KeySelector when join, you can generate a tuple to present two keys.
Upvotes: 1