flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabian Hueske <fhue...@gmail.com>
Subject Re: Regarding dividing the streams using keyby
Date Mon, 21 Nov 2016 07:48:56 GMT
Hi,

the result of a window operation on a KeyedStream is a regular DataStream.
So, you would need to call keyBy() on the result again if you'd like to
have a KeyedStream.
You can also key a stream by two or more attributes:

 DataStream<Tuple4<String, String, String, Long>> windowedStream =
                jsonToTuple.keyBy(0,1,3)  // keys be first, second, and
forth attribute

Does this answer your question?

Best, Fabian

2016-11-21 2:07 GMT+01:00 Abdul Salam Shaikh <abd.salam.shaikh@gmail.com>:

> I am trying to creating a keyed stream which collects events in a window
> using :
>
>  DataStream<Tuple4<String, String, String, Long>> windowedStream =
>                 jsonToTuple.keyBy(0)
>                             .window(GlobalWindows.create())
>                             .trigger(new WindowCustomTrigger())
>                             .apply(new WindowCrossingCalculator());
>
> Is it possible to further create a keyed stream from this already created
> keyedStream using some other field for the keyBy function ?
>
> --
> Thanks & Regards,
>
> *Abdul Salam Shaikh*
>
>

Mime
View raw message