KeyedPipeline
Routes incoming VectorNumberData messages by a key field to per-key sub-pipeline instances. Each key gets an independent sub-graph instantiated from a Prototype definition with persistent state across messages.
Configuration
Classic mode
id: Unique identifier for the operatorkey_index: Zero-based index of the key field in the input vectorprototype: ID of a prototype defined in the program'sprototypessection
{
"id": "kp1",
"key_index": 0,
"prototype": "stats_proto"
}
Computed key mode
id: Unique identifier for the operatorkeyColumnIndices: Array of column indices to include in the hash keyprototype: ID of a prototype defined in the program'sprototypessection
The operator internally computes a polynomial hash over the specified columns.
{
"id": "kp2",
"keyColumnIndices": [0, 3],
"prototype": "stats_proto"
}
Ports
- Input Port 0: VectorNumberData (must contain the key at the specified index)
- Output Port 0: VectorNumberData (classic: key prepended; computed: prototype output directly)
Operation
Classic mode
For each incoming message:
- Extract key value from input vector at
key_index - Look up or create a sub-graph for this key
- Deliver the full input vector to the sub-graph's entry operator
- Collect output from the sub-graph, prepend key value at index 0
- Emit on output port
Computed key mode
For each incoming message:
- Compute key as polynomial hash over
keyColumnIndicescolumns - Look up or create a sub-graph for this key
- Deliver the full input vector to the sub-graph's entry operator
- Collect output from the sub-graph directly (no key prepend)
- Emit on output port
Sub-graphs maintain persistent state across messages. A CumulativeSum inside a per-key sub-graph accumulates across all messages for that key.
Example (classic mode)
Prototype: VectorExtract(index=1) -> CumulativeSum
Input: t=1: [1.0, 100.0] -> key=1, sum=100 -> output: [1.0, 100.0]
Input: t=2: [2.0, 200.0] -> key=2, sum=200 -> output: [2.0, 200.0]
Input: t=3: [1.0, 150.0] -> key=1, sum=250 -> output: [1.0, 250.0]
Input: t=4: [2.0, 250.0] -> key=2, sum=450 -> output: [2.0, 450.0]
Features
- Dynamic sub-graph creation for new keys
- Optional new-key callback for runtime notification
- Full collect/restore serialization of all per-key states
- Handles both NumberData and VectorNumberData sub-graph outputs
Error Handling
- Classic mode: Throws if
key_indexis negative at construction - Classic mode: Throws at runtime if key_index is out of bounds for the input vector
- Computed key mode: Throws if
keyColumnIndicesis empty or contains negative indices