Operator Union

Primitive operator image not displayed. Problem loading file: ../../image/tk$spl/op$spl.utility$Union.svg

The Union operator merges the streams that are connected to multiple input ports into a single stream.

Checkpointed data

When the Union operator is checkpointed, logic state variables (if present) are saved in checkpoint.

Behavior in a consistent region

The Union operator can be an operator within the reachability graph of a consistent region. It cannot be the start of a consistent region. In a consistent region, a Union operator stores its state when a checkpoint is taken. When the region is reset, the operator restores the state from the checkpoint.

Checkpointing behavior in an autonomous region

When the Union operator is in an autonomous region and configured with config checkpoint : periodic(T) clause, a background thread in SPL Runtime checkpoints the operator every T seconds, and such periodic checkpointing activity is asynchronous to tuple processing. Upon restart, the operator restores its state from the last checkpoint.

When the Union operator is in an autonomous region and configured with config checkpoint : operatorDriven clause, no checkpoint is taken at runtime. Upon restart, the operator restores to its initial state.

Such checkpointing behavior is subject to change in the future.

Examples

This example uses the Union operator.


composite Main {                                                                     
  graph                                                                              
    stream<rstring a, int32 d, rstring b> A = Beacon() {}                            
    stream<rstring a, rstring b, uint32 c> B = Beacon() {}                           
    // Accept all tuples from A and B, and grab the b and a fields from each         
    stream <rstring b, rstring a> C = Union (A; B) {}                                
}

Summary

Ports
This operator has 2 or more input ports and 1 output port.
Windowing
This operator does not accept any windowing configurations.
Parameters
This operator does not support parameters.
Metrics
This operator does not report any metrics.

Properties

Implementation
C++
Threading
Always - Operator always provides a single threaded execution context.

Input Ports

Ports (0...1)

The Union operator has two or more input ports, which ingest tuples to be unioned. All attributes in the output port must be present in the schema of each input port, with the same type. The order of attributes in the input port is not required to match the output port. The input port schemas can contain extra attributes that do not appear in the output port schema.

Properties

Ports (2...)

Additional ports that ingest tuples to be unioned.

Properties

Output Ports

Assignments
This operator does not allow assignments to output attributes.
Ports (0)

The Union operator has one output port, which produces unioned tuples. The output tuple attributes are automatically forwarded from the input ones.

Properties

Code Templates

Union

stream<${schema}> ${outputStream} = Union(${inputStream1};${inputStream2}) {
        }