You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 小旋锋 <wh...@qq.com> on 2020/03/06 09:09:51 UTC

keyby后滚动窗口,watermark如何只触发所在的组,而不触发所有的组

大家好:
&nbsp; &nbsp; &nbsp; &nbsp; 数据流经过 keyby 分组后,在分别进入滚动窗口:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sourceDataStream .keyBy(id) .window(TumblingEventTimeWindows.of(Time.seconds(10L)))&nbsp;.reduce() .print()
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; 测试数据:id 从1~1500,每个id由两条数据,每条数据的 eventtime是一样的,最后一条是id为1,eventtime大了20秒用来触发窗口计算的数据
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;实验结果:最后一条用来触发的数据发出后,所有的窗口都计算输出了
&nbsp; &nbsp; &nbsp;&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;请问如何配置 最后一条id为1的数据只触发 id=1所在的组的窗口呢?


感谢

Re: keyby后滚动窗口,watermark如何只触发所在的组,而不触发所有的组

Posted by LakeShen <sh...@gmail.com>.
准确的说,WaterMark 是作用在一个算子的 SubTask 上面。当一个SubTask 有多个输入的时候,回取多个输入里面最小的
Watermark.
WaterMark新生成的条件,比之前的 Watermark大且非空。

Best,
LakeShen

17626017841 <17...@163.com> 于2020年3月6日周五 下午8:36写道:

> Hi,
>
> Keyby是把相同的key分配到同一个窗口处理,哪些key分配到哪个窗口,跟你设置得的窗口并行度有关?如果想把某个key分到单独的一个窗口实例我觉得需要自定义partition.
>
>
> Best,
> Sun.Zhu
>
>
>
>
> | |
> 17626017841
> |
> |
> 邮箱:17626017841@163.com
> |
>
> Signature is customized by Netease Mail Master
>
> 在2020年03月06日 17:20,Utopia 写道:
> Hi,
>
> Flink 的水印在同一个算子上都是一样的,所以每个 keyed stream 共享的是一个水印,不能分别触发器。
>
> Best  regards
> Utopia
> 在 2020年3月6日 +0800 17:10,小旋锋 <wh...@qq.com>,写道:
> > 大家好:
> > &nbsp; &nbsp; &nbsp; &nbsp; 数据流经过 keyby 分组后,在分别进入滚动窗口:
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sourceDataStream .keyBy(id)
> .window(TumblingEventTimeWindows.of(Time.seconds(10L)))&nbsp;.reduce()
> .print()
> > &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
> > &nbsp; &nbsp; &nbsp; &nbsp; 测试数据:id 从1~1500,每个id由两条数据,每条数据的
> eventtime是一样的,最后一条是id为1,eventtime大了20秒用来触发窗口计算的数据
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;实验结果:最后一条用来触发的数据发出后,所有的窗口都计算输出了
> > &nbsp; &nbsp; &nbsp;&nbsp;
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;请问如何配置 最后一条id为1的数据只触发 id=1所在的组的窗口呢?
> >
> >
> > 感谢
>

回复:keyby后滚动窗口,watermark如何只触发所在的组,而不触发所有的组

Posted by 17626017841 <17...@163.com>.
Hi,
Keyby是把相同的key分配到同一个窗口处理,哪些key分配到哪个窗口,跟你设置得的窗口并行度有关?如果想把某个key分到单独的一个窗口实例我觉得需要自定义partition.


Best,
Sun.Zhu




| |
17626017841
|
|
邮箱:17626017841@163.com
|

Signature is customized by Netease Mail Master

在2020年03月06日 17:20,Utopia 写道:
Hi,

Flink 的水印在同一个算子上都是一样的,所以每个 keyed stream 共享的是一个水印,不能分别触发器。

Best  regards
Utopia
在 2020年3月6日 +0800 17:10,小旋锋 <wh...@qq.com>,写道:
> 大家好:
> &nbsp; &nbsp; &nbsp; &nbsp; 数据流经过 keyby 分组后,在分别进入滚动窗口:
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sourceDataStream .keyBy(id) .window(TumblingEventTimeWindows.of(Time.seconds(10L)))&nbsp;.reduce() .print()
> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
> &nbsp; &nbsp; &nbsp; &nbsp; 测试数据:id 从1~1500,每个id由两条数据,每条数据的 eventtime是一样的,最后一条是id为1,eventtime大了20秒用来触发窗口计算的数据
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;实验结果:最后一条用来触发的数据发出后,所有的窗口都计算输出了
> &nbsp; &nbsp; &nbsp;&nbsp;
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;请问如何配置 最后一条id为1的数据只触发 id=1所在的组的窗口呢?
>
>
> 感谢

Re:keyby后滚动窗口,watermark如何只触发所在的组,而不触发所有的组

Posted by Utopia <ge...@gmail.com>.
Hi,

Flink 的水印在同一个算子上都是一样的,所以每个 keyed stream 共享的是一个水印,不能分别触发器。

Best  regards
Utopia
在 2020年3月6日 +0800 17:10,小旋锋 <wh...@qq.com>,写道:
> 大家好:
> &nbsp; &nbsp; &nbsp; &nbsp; 数据流经过 keyby 分组后,在分别进入滚动窗口:
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sourceDataStream .keyBy(id) .window(TumblingEventTimeWindows.of(Time.seconds(10L)))&nbsp;.reduce() .print()
> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
> &nbsp; &nbsp; &nbsp; &nbsp; 测试数据:id 从1~1500,每个id由两条数据,每条数据的 eventtime是一样的,最后一条是id为1,eventtime大了20秒用来触发窗口计算的数据
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;实验结果:最后一条用来触发的数据发出后,所有的窗口都计算输出了
> &nbsp; &nbsp; &nbsp;&nbsp;
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;请问如何配置 最后一条id为1的数据只触发 id=1所在的组的窗口呢?
>
>
> 感谢