apache-flinkflink-streamingflink-batch

Can window operator be used in flink batch mode?


I have a program that contains window operator. It works perfectly in streaming mode. However, when I switch to batch mode, window is not emitted. My question is:

  1. Is it due to watermark not advanced in batch mode?
  2. How can I use window operator in batch mode?

Solution

  • I assume you are referring using to batch execution mode with the DataStream or Table API (and not the legacy DataSet API).

    Watermarks are unnecessary in batch mode, but you do need to use a source that handles bounded inputs, so that Flink realizes it has fully processed all of the input. For example, if you are using the KafkaSource you must use setBounded(), or if you are using the FileSource then you should not use monitorContinuously().