I don't think you can specify custom triggers when using purer SQL, but maybe Fabian or Timo know a SQL way of implementing your goal.

On 12.03.2018 13:16, 李玥 wrote:
Hi Chirag,
Thank for your reply!
I found a provided ContinuousEventTimeTrigger should be worked in my situation. Most examples are based on Table API like ‘ds.keyBy(0).window().trigger(MyTrigger.of())…’, But how to apply the trigger to a pure Flink SQL Application ?

在 2018年3月12日,下午5:20,Chirag Dewan <chirag.dewa...@yahoo.in <mailto:chirag.dewa...@yahoo.in>> 写道:

Hi LiYue,

This should help : Apache Flink 1.5-SNAPSHOT Documentation: Windows <https://ci.apache.org/projects/flink/flink-docs-master/dev/stream/operators/windows.html#triggers>


    Apache Flink 1.5-SNAPSHOT Documentation: Windows


So basically you need to register a processing time trigger at every 10 minutes and on callback, you can FIRE the window result like this:

public TriggerResult onProcessingTime(long time, TimeWindow window, TriggerContext ctx) throws Exception {
      // schedule next timer
ctx.registerProcessingTimeTimer(System.currentTimeMillis() + 1000L);
      return TriggerResult.FIRE;

I hope it helps.


On Monday, 12 March, 2018, 2:10:25 PM IST, 李玥 <liyue2...@gmail.com <mailto:liyue2...@gmail.com>> wrote:

I’m working on a event-time based aggregation application with flink SQL. Is there any way to keep sinking partial aggregation result BEFORE time window closed?
For example, My SQL:
    select …
    from my_table
    GROUP BY TUMBLE(`timestamp`, INTERVAL '1’ DAY),other_column;
Usually, Flink sink agg result after time-window closed, Is there any way to keep sinking TODAY’s partial aggregation result every 10 miniutes so we can see today’s performance on my chart.


Reply via email to