2

When I use flink event time window, the window just doesn't trigger. How can I solve the problem, and are there any ways to debug?

Hellen
  • 3,472
  • 5
  • 18
  • 25

2 Answers2

7

As you are using the event time window, it is probably a watermark problem. The window only output when watermarks make a progress. There are some reasons why the event time has not been advanced:

  1. There are no data from the source
  2. One of the source parallelisms doesn't have data
  3. The time field extracted from the record should be millisecond instead of second.
  4. Data should cover a longer time span than the window size to advance the event time.

The window will output if we change event time to processing time. Furthermore, we can monitor event time by checking the watermarks in the web dashboard[1] or print-debug it with a ProcessFunction which can lookup the current watermark.

[1] https://ci.apache.org/projects/flink/flink-docs-master/monitoring/debugging_event_time.html#monitoring-current-event-time

Hellen
  • 3,472
  • 5
  • 18
  • 25
  • Hi, could you please clarify what you mean by #2 ("One of the source parallelisms doesn't have data) above? Is this a Flink bug? If it's expected behavior, I don't see it documented anywhere. Thanks! – karthitect Jun 21 '20 at 03:45
  • @karthitect hi, it's not a Flink bug. Some descriptions here: https://ci.apache.org/projects/flink/flink-docs-stable/dev/event_time.html#idling-sources – Hellen Jun 24 '20 at 05:02
  • thanks. So please correct me if I'm mistaken - this wouldn't be an issue if we're using an assigner derived from AssignerWithPeriodicWatermarks? – karthitect Jun 24 '20 at 13:19
2

Be sure you're setting environment.setStreamTimeCharacteristic(TimeCharacteristic.EventTime).

gcandal
  • 937
  • 8
  • 23