Comparing Streams, Windows, and Delta Streams

Streams, windows, and delta streams offer different characteristics and features, but also share common designation, visibility, and column parameters.

The terms stateless and stateful commonly describe the most significant difference between windows and streams. A stateful element has the capacity to store information, while a stateless element does not.

Streams, windows, and delta streams share several important characteristics, including implicit columns and visibility rules.

Feature Capability Streams Windows Delta Streams
Type of element Stateless Stateful, due to retention and store capabilities Stateless
Data retention None Yes, rows (based on retention policy) None
Available store types Not applicable Memory store or log store Not applicable
Element types that can be derived from this element Stream or a Window with an aggregation clause (GROUP BY) Stream, Window, Delta Stream Stream, Window, Delta Stream
Primary key Required No Yes, explicit or deduced Yes, explicit or deduced
Support for aggregation operations No Yes No
Behavior on receiving insert/update/delete Produces insert. Converts update to insert. Ignores delete. Produces insert, update, or delete according to the exceptions listed below. Generates an error on duplicate inserts, bad updates, and bad deletes. Windows with a retention policy treat update as upsert. Produces insert, update, or delete according to the exceptions listed below. Does not detect duplicate inserts, bad updates, or bad deletes. Delta streams produced by a Flex Operator do not receive updates.
Behavior on receiving upsert/safedelete Converts upsert to insert. Ignores safedelete. Produces insert, update, or delete according to the exceptions listed below. Delta streams do not receive upserts or safedeletes.

Exceptions

A window can produce output event records with different opcodes depending on what changes are made to the contents of its store by the incoming event and its opcode. For example:
  • In a window performing aggregation logic, an incoming event record with an insert opcode can update the contents of the store and output an event record with an update opcode. This can also happen in a window implementing a left join.
  • In a window with a count-based retention policy, an incoming event record with an insert opcode can cause the store to exceed this count. The window deletes the excess rows, producing an event record with a delete opcode.
For a filter, a delta stream modifies the opcode it receives.
  • An input record with an insert opcode that satisfies the filter clause has an insert opcode on the output. If it does not meet the criteria, no opcode is output.
  • An input record with an update opcode, where the update meets the criteria but the original record does not, outputs with an insert opcode. However, if the old record meets the criteria, it outputs with an update opcode. If the original insert meets the filter criteria but the update does not, it outputs a delete opcode.
  • An input record with a delete opcode outputs with a delete opcode, as long as it meets the filter criteria.