apache-flinkflink-sql

How to handle late events using Flink's table API?


It looks like Flink's Table API currently drop late events. I've seen some examples leveraging the DataStreaming API, but my entire Flink application uses the Table API, so I am trying to find a way to handle late events using the latter. I've found this approach from 3 years ago, but I am not sure it works anymore.


Solution

  • I was able to dump all late events to a sink using the Table API with the second link in the post:

    INSERT INTO lateEventsTable 
        SELECT * 
        FROM sourcedEventsTable
        WHERE CURRENT_WATERMARK(eventTime) IS NOT NULL
            AND eventTime <= CURRENT_WATERMARK(eventTime)
    

    If you want to be able to do more with late events you will need to use the DataStream API (AFAIK).