Hi,

time_str 在前面已经处理过了,处理成了 10:00, 10:10, 10:20... 这种10分钟间隔的点,所以按照 time_str
分组的话,一天下来也就 24*6 个点。
在 Flink SQL 中,并不一定要 GROUP BY TUMLBE 才能做类似窗口聚合的操作,直接 GROUP BY hour/min/ts
也能达到类似的效果。
只不过前者不会输出更新,且能自动清理 state,后者会输出更新且不会自动清理 state。

Best,
Jark

On Sat, 21 Mar 2020 at 11:24, Tianwang Li <[email protected]> wrote:

> Hi, Jark , 看了你的文章,有一点不是很清楚。
>
> 基于 uv_per_10min 再根据分钟时间进行一次聚合,这样每10分钟只有一个点会存储在 Elasticsearch 中,对于
> Elasticsearch 和 Kibana 可视化渲染的压力会小很多。
>
> INSERT INTO cumulative_uv
> SELECT time_str, MAX(uv)
> FROM uv_per_10min
> GROUP BY time_str;
>
>
> 怎么实现按分钟聚合?没有明显的窗口设置。有什么内在特性?
>
>
> Jark Wu <[email protected]> 于2020年3月20日周五 上午12:25写道:
>
> > Hi 你可以看下这篇文章是否满足的你需求:
> >
> >
> http://wuchong.me/blog/2020/02/25/demo-building-real-time-application-with-flink-sql
> > #
> > <
> http://wuchong.me/blog/2020/02/25/demo-building-real-time-application-with-flink-sql#
> >
> > 统计一天每10分钟累计独立用户数
> >
> > Best,
> > Jark
> >
> >
> > On Thu, 19 Mar 2020 at 23:30, hiliuxg <[email protected]> wrote:
> >
> > > hi all:有这样子一个场景,我想通过每隔5分钟统计当日零点到当前5分钟的pv和uv,用批处理大概大概表达如下:
> > > select&nbsp; &nbsp;
> > > &nbsp;'2020-03-19' as dt ,&nbsp;&nbsp;
> > > &nbsp;'2020-03-19 12:05:00'&nbsp; as etltime ,
> > > &nbsp;count(1) as pv ,&nbsp;
> > > &nbsp;count(distinct userid) as uv&nbsp;
> > > from t_user_log&nbsp;
> > > where&nbsp; logintime&nbsp; &gt;= '2020-03-19 00:00:00' and logintime <
> > > '2020-03-19 12:05:00'&nbsp;
> > >
> > >
> > > 这里,没法用flink sql 处理,当时这种场景又特别多,各位大神有好的方案处理吗?
> >
>
>
> --
> **************************************
>  tivanli
> **************************************
>

回复