In some cases, a particular event can cause multiple output rows, and those rows can be grouped into a bundle. A bundle is a set of two or more data messages that are conceptually part of the same operation and are thus grouped together.
Your output adapter may see and process bundles differently from individual messages.
Bundles apply only to adapters, and not to UDFs.
There are two situations in which bundles may occur:
Bundles can occur when you have a query that joins a stream to a window. In some cases, a row that arrives in the stream may match multiple rows in the window, and for each of those matches the join query will produce an output row. In that case, all the output rows for a given input row will not only have the same row timestamp, but also will be considered part of a "bundle", since they were all generated by the same event (the same arriving message/row).
Bundles can also occur when you use the XML "shred" command. A single XML value may contain multiple elements, and some operations on that XML value may generate multiple rows (one per element). In this situation, all the rows generated from that one XML input value will be bundled together.
Bundling is not the same as aggregating. An aggregate function, such as AVG() or SUM(), produces a single output from multiple input rows. For example, if you have 100 stock transactions and thencalculate the average price, you will onlyonly receive oneoutput (the average price). If you perform an operation that creates a bundle, that bundle can have multiple rows instead of just one, even though the entire bundle was created based on a single event or arriving row. Each of the rows in a bundle is a discrete row, and any query downstream will see (and process) each of those rows.
Although all messages in a bundle have the same row timestamp, not all messages with the same row timestamp are necessarily in the same bundle.
A bundle may contain any type of message (for example, negative tuples as well as positive tuples) EXCEPT other bundles. In other words, there is no such thing as a nested bundle.
In some situations, your output adapter may need to recognize that messages have arrived as a bundle and may need to extract individual messages and possibly process the bundled messages in a special way.
The details of extracting messages from a bundle are specific to each SDK (for example, the Sybase CEP Java SDK vs. the Sybase CEP C/C++ SDK) and are discussed in more detail later.