@Public public class CoGroupedStreams<T1,T2> extends Object
CoGroupedStreams
represents two DataStreams
that have been co-grouped.
A streaming co-group operation is evaluated over elements in a window.
To finalize co-group operation you also need to specify a KeySelector
for
both the first and second input and a WindowAssigner
.
Note: Right now, the groups are being built in memory so you need to ensure that they don't get too big. Otherwise the JVM might crash.
Example:
DataStream<Tuple2<String, Integer>> one = ...;
DataStream<Tuple2<String, Integer>> two = ...;
DataStream<T> result = one.coGroup(two)
.where(new MyFirstKeySelector())
.equalTo(new MyFirstKeySelector())
.window(TumblingEventTimeWindows.of(Time.of(5, TimeUnit.SECONDS)))
.apply(new MyCoGroupFunction());
Modifier and Type | Class and Description |
---|---|
static class |
CoGroupedStreams.TaggedUnion<T1,T2>
Internal class for implementing tagged union co-group.
|
class |
CoGroupedStreams.Where<KEY>
CoGrouped streams that have the key for one side defined.
|
static class |
CoGroupedStreams.WithWindow<T1,T2,KEY,W extends Window>
A co-group operation that has
KeySelectors defined for both inputs as
well as a WindowAssigner . |
Constructor and Description |
---|
CoGroupedStreams(DataStream<T1> input1,
DataStream<T2> input2)
Creates new CoGroped data streams, which are the first step towards building a streaming co-group.
|
Modifier and Type | Method and Description |
---|---|
<KEY> CoGroupedStreams.Where<KEY> |
where(KeySelector<T1,KEY> keySelector)
Specifies a
KeySelector for elements from the first input. |
public CoGroupedStreams(DataStream<T1> input1, DataStream<T2> input2)
input1
- The first data stream.input2
- The second data stream.public <KEY> CoGroupedStreams.Where<KEY> where(KeySelector<T1,KEY> keySelector)
KeySelector
for elements from the first input.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.