Processing tuples Sample Clauses

Processing tuples. A fundamental property of CQL is that windows are calculated conceptually using a time- driven model [11]. All stream tuples are of the form (value, timestamp) and the contents of a window are updated at the end each time step T, with regard to tuples with timestamps equal to or smaller than T. Regardless of how many tuples arrive at any given timestamp, the window is only updated when it is known that no further tuples can arrive for said timestamp. This model can be contrasted to a tuple-based model, where a window’s content is re- evaluated every time a new tuple arrives. The differences between the two models are illustrated with an example. Assume the following stream of purchases: Purchases ( auction_id , buyer , cost , time ) = (1, " Lars ", 30, 0) (2, " Mia", 10, 1) (3, " Sven ", 50, 1) (4, " Klara ", 50, 1) (5, " Svea ", 60, 2) The following query is stated: ISTREAM ( SELECT AVG ( cost ) as AvgCost , time FROM Purchases [ ROWS 10]); Using a time-driven model the window is re-evaluated only at the end of each time step, giving the following output stream: (30 , 0) (35 , 1) (40 , 2) With a tuple-driven model the window is re-evaluated every time a new tuple arrives. This gives us the following output stream: (30 , 0) (20 , 1) (30 , 1) (35 , 1) (40 , 2) Further examples and an investigation of the strengths and limitations of both models can be found in [9].