Class DataStreamUtils
- java.lang.Object
-
- org.apache.flink.streaming.api.datastream.DataStreamUtils
-
@Experimental public final class DataStreamUtils extends Object
A collection of utilities forDataStreams.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,K>
org.apache.flink.streaming.api.datastream.KeyedStream<T,K>reinterpretAsKeyedStream(org.apache.flink.streaming.api.datastream.DataStream<T> stream, org.apache.flink.api.java.functions.KeySelector<T,K> keySelector)Reinterprets the givenDataStreamas aKeyedStream, which extracts keys with the givenKeySelector.static <T,K>
org.apache.flink.streaming.api.datastream.KeyedStream<T,K>reinterpretAsKeyedStream(org.apache.flink.streaming.api.datastream.DataStream<T> stream, org.apache.flink.api.java.functions.KeySelector<T,K> keySelector, org.apache.flink.api.common.typeinfo.TypeInformation<K> typeInfo)Reinterprets the givenDataStreamas aKeyedStream, which extracts keys with the givenKeySelector.
-
-
-
Method Detail
-
reinterpretAsKeyedStream
public static <T,K> org.apache.flink.streaming.api.datastream.KeyedStream<T,K> reinterpretAsKeyedStream(org.apache.flink.streaming.api.datastream.DataStream<T> stream, org.apache.flink.api.java.functions.KeySelector<T,K> keySelector)Reinterprets the givenDataStreamas aKeyedStream, which extracts keys with the givenKeySelector.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).- Type Parameters:
T- Type of events in the data stream.K- Type of the extracted keys.- Parameters:
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 aDataStream.keyBy(KeySelector).keySelector- Function that defines how keys are extracted from the data stream.- Returns:
- The reinterpretation of the
DataStreamas aKeyedStream.
-
reinterpretAsKeyedStream
public static <T,K> org.apache.flink.streaming.api.datastream.KeyedStream<T,K> reinterpretAsKeyedStream(org.apache.flink.streaming.api.datastream.DataStream<T> stream, org.apache.flink.api.java.functions.KeySelector<T,K> keySelector, org.apache.flink.api.common.typeinfo.TypeInformation<K> typeInfo)Reinterprets the givenDataStreamas aKeyedStream, which extracts keys with the givenKeySelector.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).- Type Parameters:
T- Type of events in the data stream.K- Type of the extracted keys.- Parameters:
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 aDataStream.keyBy(KeySelector).keySelector- Function that defines how keys are extracted from the data stream.typeInfo- Explicit type information about the key type.- Returns:
- The reinterpretation of the
DataStreamas aKeyedStream.
-
-