Apache Flink: SlidingProcessingTimeWindows with ProcessWindowFunction not producing expected output

So I have an extremely simple streaming pipeline setup using apache flink, streaming data from kinesis, I don’t think this really matters but I am using AWS’s Managed Flink Environment, that said here is my implementation.


Each individual event payload from stream

class Event {
 String deviceId;
 String metricName;
 Double value;
 // added for debugging - while I parse the record, the deserializer uses the current system time to automatically add this field.
 String receivedTimeStamp;
}

Streaming Pipeline

final DataStream<Event> stream = // create streaming kinesis source

// setting up an extremely simple pipeline
stream.keyBy(Event::getDeviceId)
                .window(SlidingProcessingTimeWindows.of(
                        /*Window length*/ Time.hours(2),
                        /*Slide length*/  Time.hours(1)))
                .process(new EventsWindowFunction());

List<TransformedEvent> – OUT of my ProcessWindowFunction

public class TransformedEvent {
    private String deviceId;
    private Double value;
    private String metricName;
    // added for debugging - this is simply read from Event item from each element in Iterable<Event> iterable
    String receivedTimeStamp;
}

ProcessWindowFunction

@Override
    public void process(
            final String s,
            final Context context,
            final Iterable<Event> iterable,
            final Collector<List< TransformedEvent>> collector) throws Exception {
        // using this for logging
        final String deviceId = Iterables.get(iterable, 0).getDeviceId();
        final List<TransformedEvent> output = new ArrayList<>();
        StreamSupport.stream(iterable.spliterator(), false)
                .map(/* Transform raw Event to ConsolidatedEvent*/)
                .forEach(output::add);
        // added logging here to print the entire output for the deviceId (keying by deviceId)
        collector.collect(output);
    }

Here is what I am noticing with the above implementation:

For lets say a deviceId ABC I am seeing the following output:

Output at 6AM (window from 4-6am)

  • List<TransformedEvent>
    • deviceId: ABC value: 0.79 metricName: MetricOne receivedTimeStamp: 5:07 AM
    • deviceId: ABC value: 0.12 metricName: MetricTwo receivedTimeStamp: 4:15 AM

Output at 7AM (window from 5-7am)

  • Nothing for deviceId: ABC

My Question

  • According to the documentation on sliding windows shouldn’t MetricOne for deviceId ABC appear in 5-7am window ? As seen above it currently only shows up from 4-6am window and not in the subsequent window (ie 5-7am). But I also noticed that in the 4-6 am window it correctly included events from the previous window (ie 3-5am). So I’m confused.
  • I am almost certain I’m overlooking some caveats, so looking for any pointers whatsoever. Also the deviceId may not have emitted an event after the last event that was received at 5:07 AM.
  • Also as David Anderson always says if you are not seeing expected results switch to using “wallclock time/ingestion time” and I believe using SlidingProcessingTimeWindows should be automatically considering ingestion time ? I am suspecting I am misunderstanding something at this specific point, but only my speculation.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật