Punctuation

Punctuation is a control signal that appears interleaved with the tuples in a stream.

SPL supports the following kinds of punctuation:

  • Window punctuation creates boundaries within a stream that can be used for a user-defined window.
  • Final punctuation marks the end of a stream. Final punctuation indicates that no further tuples are received on an input port. The run time automatically forwards them to output ports as required.

Window punctuation processing

SPL supports two kinds of streams: a punctuation-free stream is a sequence of tuples, whereas a punctuated stream is a sequence of tuples that are interleaved with window punctuation. In both cases, the sequence of tuples continues indefinitely, unless the job ends, in which case the sequence is terminated by a final punctuation marker. A window punctuation separates groups of consecutive tuples on a stream to create window boundaries. For example, consider an invocation of an Aggregate operator with a punctuation-based window. Each time this operator invocation receives a window punctuation, it aggregates the accumulated tuples since the last window punctuation.

An output port of an operator invocation can either generate, remove, or preserve window punctuation markers. Examples for punctuation-generating ports include the output from the Join, Aggregate, and Punctor operators. Punctuation-free output ports ensure that their stream is not punctuated, and punctuation-preserving output ports forward window punctuation from an associated punctuated input port.

An input port of an operator invocation can either be punctuation-oblivious or punctuation-expecting. Ports are oblivious to window punctuation if they do not require a punctuated stream to function correctly. As a result, these kinds of ports work with both punctuated and punctuation-free streams. Ports are punctuation-expecting if they require a punctuated stream to function correctly. For example, ports with punctuation-based windows are punctuation-expecting. As a result, these kinds of ports work only with punctuated streams. Punctuation-expecting ports must be connected to exactly one input stream. The compiler enforces these rules of window punctuation by reporting errors when they are violated.