Use the GROUP BY clause to establish a grouping for an OUTPUT EVERY clause.
The grouping causes all output rows with the same grouping value to be treated as a separate set of rows from all other groups. Each group is published separately but all groups are published at the same interval.
The output schema should be modified to include the grouped column (symbol). Sybase CEP will not prevent the publication of grouped values without the grouping columns, but there will be no way to identify which rows in the output stream belong to which group. The output will be sent to the StockVolumeOut2 stream:
Column | Datatype | Description |
---|---|---|
symbol | String | The value of the stock symbol for each group. |
totalvolume | Integer | The total volume for the current day's trading for this stock symbol. |
First, here is an example of OUTPUT EVERY with a grouping by symbol:
Notice that each interval may have more than one row, depending on what rows entered the window during each interval. Only groups that have new data for an interval are published at the end of the interval. This is why the interval ending at 07:15:15 only has an ORCL row, because no other symbols occurred between 07:15:10 and 07:15:15. Also notice, however, that the output for the interval is still based on the window, which is larger than the interval, so that data from previous intervals is accumulated (the window keeps data for one day).
Here is a similar example using OUTPUT ALL EVERY. As might be expected, this publishes values for each group for every interval (once there is data from the group in the window at all), regardless of whether any new rows have entered the window during the preceding interval: