Streaming SQL with Materialised Views: RisingWave versus a Hand-Written Kafka Consumer
Should live aggregates over a Kafka stream be written by hand as a consumer, or declared as SQL materialised views in a streaming database? A seeded generator writes orders, payments and cancellations into three Apache Kafka topics, with duplicates, late and out-of-order event times and payments that arrive before their order, so the exact answers are known. Four arms compute the same four answers - revenue per region without cancelled orders, per category and one-minute event-time window, paid orders per region (a stream-stream join) and the top 10 customers: RisingWave with 3 tables with primary keys and 7 materialised views (28 lines of SQL); a hand-written Python consumer with deduplication, an early-payment buffer, retractions and a snapshot of state and offsets (165 lines); the same consumer without the correctness code; and RisingWave with a 100 ms barrier.
NOTE: Synthetic seeded orders stream with known ground truth; the same four answers computed by four arms, one at a time; every service ran locally on a standard laptop.
Category: Big Data
Big Data Project BD07 from ProTechSC Academy, with graphical abstract, video demonstration and project guidance.