2.3.4 Notes on using the linking process and the ROWS window together

This subsection gives more details about using the linking process and the ROWS window together.

If the number of tuples that are output as a result of the linking process exceeds the number of tuples specified in the ROWS window, only the number of tuples specified in the ROWS window are output; not all of the processing results are output.

This problem occurs if you specify queries that satisfy the following conditions:

  1. A linking operation in a query generates multiple data items at the same time.
  2. In a separate query following the first query, processing is performed that uses the results of the query in 1 above; in this query, the specified number of tuples in the ROWS window is less than the number of data items generated in the first query.

The following example shows queries that satisfy these conditions.

REGISTER STREAM s1 (c1 INT);
REGISTER STREAM s2 (c2 INT);
REGISTER QUERY q1 ISTREAM(        query-in-condition-1
 SELECT * FROM s1[ROWS 3], s2[ROWS 3]);
REGISTER QUERY q2 ISTREAM(        query-in-condition-2
 SELECT * FROM q1[ROWS 1]);

For these queries, let us assume that a tuple arrives at stream s1 or s2 at time t. In query q1, two stream data items are input and linked. Since [ROWS 3] is specified for the input stream data, the linking operation at time t generates three tuples having the same time stamp.

Since the number of tuples (1) specified in the ROWS window in query q2 is less than the number of data items (3) generated in query q1 and still in the window, only the last tuple arriving in the window at time t survives. Of the processing results output from query q1, the remaining two tuples are not output when q2 is processed.

In this example, you would need to change the CQL by specifying a value greater than 3 in the ROWS window in query q2.