@Experimental public final class DataStreamUtils extends Object
DataStreams
.Modifier and Type | Method and Description |
---|---|
static <OUT> Iterator<OUT> |
collect(DataStream<OUT> stream)
Returns an iterator to iterate over the elements of the DataStream.
|
static <T,K> KeyedStream<T,K> |
reinterpretAsKeyedStream(DataStream<T> stream,
org.apache.flink.api.java.functions.KeySelector<T,K> keySelector)
|
static <T,K> KeyedStream<T,K> |
reinterpretAsKeyedStream(DataStream<T> stream,
org.apache.flink.api.java.functions.KeySelector<T,K> keySelector,
org.apache.flink.api.common.typeinfo.TypeInformation<K> typeInfo)
|
public static <OUT> Iterator<OUT> collect(DataStream<OUT> stream) throws IOException
IOException
public static <T,K> KeyedStream<T,K> reinterpretAsKeyedStream(DataStream<T> stream, org.apache.flink.api.java.functions.KeySelector<T,K> keySelector)
DataStream
as a KeyedStream
, which extracts keys with the given
KeySelector
.
IMPORTANT: For every partition of the base stream, the keys of events in the base stream must be
partitioned exactly in the same way as if it was created through a DataStream.keyBy(KeySelector)
.
T
- Type of events in the data stream.K
- Type of the extracted keys.stream
- The data stream to reinterpret. For every partition, this stream must be partitioned exactly
in the same way as if it was created through a DataStream.keyBy(KeySelector)
.keySelector
- Function that defines how keys are extracted from the data stream.DataStream
as a KeyedStream
.public static <T,K> KeyedStream<T,K> reinterpretAsKeyedStream(DataStream<T> stream, org.apache.flink.api.java.functions.KeySelector<T,K> keySelector, org.apache.flink.api.common.typeinfo.TypeInformation<K> typeInfo)
DataStream
as a KeyedStream
, which extracts keys with the given
KeySelector
.
IMPORTANT: For every partition of the base stream, the keys of events in the base stream must be
partitioned exactly in the same way as if it was created through a DataStream.keyBy(KeySelector)
.
T
- Type of events in the data stream.K
- Type of the extracted keys.stream
- The data stream to reinterpret. For every partition, this stream must be partitioned exactly
in the same way as if it was created through a DataStream.keyBy(KeySelector)
.keySelector
- Function that defines how keys are extracted from the data stream.typeInfo
- Explicit type information about the key type.DataStream
as a KeyedStream
.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.