Class DataStreamUtils

    • Method Detail

      • reinterpretAsKeyedStream

        public static <T,​K> KeyedStream<T,​K> reinterpretAsKeyedStream​(DataStream<T> stream,
                                                                                  KeySelector<T,​K> keySelector)
        Reinterprets the given 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).

        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 a DataStream.keyBy(KeySelector).
        keySelector - Function that defines how keys are extracted from the data stream.
        Returns:
        The reinterpretation of the DataStream as a KeyedStream.
      • reinterpretAsKeyedStream

        public static <T,​K> KeyedStream<T,​K> reinterpretAsKeyedStream​(DataStream<T> stream,
                                                                                  KeySelector<T,​K> keySelector,
                                                                                  TypeInformation<K> typeInfo)
        Reinterprets the given 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).

        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 a DataStream.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 DataStream as a KeyedStream.