How to get the evaluation result of a time-based window aggregation in time after a new event falling into the window?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get the evaluation result of a time-based window aggregation in time after a new event falling into the window?

Longdexin
Hi,
I'm a new user of Flink, and have been puzzled a lot by the time-based window aggregation result. 
For our business, hourly and daily reports have to been created best in a real time style.  So, I used a event-time based window aggregation to consume the Kafka  data stream, but found that, only after the current hour or day passed, the newest result could be seen on console or upserted to MySQL. 
How can I get the latest window result immediately after a stream record falling into it? Is there a specific configuration option for this, hopefully? Please help and rescue me.
Best regards.
Reply | Threaded
Open this post in threaded view
|

Re:How to get the evaluation result of a time-based window aggregation in time after a new event falling into the window?

forideal
Hi Chengcheng Zhang,
  
          Is this your scene? For example, every day is divided into 12 hours, let’s take today as an example, 2020081600 2020081601,...2020081623
For example, if we count pv, we can count like this
INSERT INTO cumulative_pv
SELECT time_str, count(1)
FROM pv_per_hour
GROUP BY time_str;
In this sql, time_str is an hour in 2020081600, 2020081601,...2020081623.


Hope this helps.

Best, forideal



At 2020-08-16 12:05:04, "Chengcheng Zhang" <[hidden email]> wrote:

Hi,
I'm a new user of Flink, and have been puzzled a lot by the time-based window aggregation result. 
For our business, hourly and daily reports have to been created best in a real time style.  So, I used a event-time based window aggregation to consume the Kafka  data stream, but found that, only after the current hour or day passed, the newest result could be seen on console or upserted to MySQL. 
How can I get the latest window result immediately after a stream record falling into it? Is there a specific configuration option for this, hopefully? Please help and rescue me.
Best regards.