...
Code Block |
---|
from overdueDeliveries as overdueStream unidirectional join pizza_deliveries on pizza_deliveries.order_id == overdueStream.orderNo select count(overdueStream.orderNo) as sumOrderId, overdueStream.customerName insert into deliveredOrders; |
In the The above query,
- Joins
pizza_deliveries
table with theoverdueDeliveries
stream (the aliasoverdueStream
is used for convenience here) - The Uses a join operation compares to compare each event in the event table (
pizza_deliveries
) with each incoming event fromoverdueDeliveries
stream
Note that,- Events received through the
overdueDeliveries
arrive 30 seconds after the actual order happens - A result of this join operation indicates (since we match the order ids) that the order is already delivered within 30 seconds
- Events received through the
- Inserts the successful delivery information to the
deliveredOrders
stream, which can be used to monitor the status of orders
...