Operator Deserializer
The Deserializer operator reverts the operation of the Serializer operator. Blob data received on the input port (specified by the serializedData parameter) is de-serialized then assigned to the designated output attributes.
- Output attributes with assignment from output function deserialized(int32 i), or
- All output attributes if the operator invocation has no explicit output assignment.
The types, names, and order of the serialized attributes MUST match the designated output attributes.
When the Serializer sends a payload with type information embedded, the received list is checked against the types and names of the designated output attributes. If the type does not match, an exception is thrown and the operator terminates.
Examples
use com.teracloud.streams.inet.util::*;
public composite Main {
type
PersonType = rstring firstName, rstring lastName, uint8 age;
graph
stream<PersonType> Input = Beacon() {}
stream<blob binData> SerializedStream = Serializer(Input) {
output SerializedStream:
binData = serialized();
}
stream<PersonType> DeserializedStream = Deserializer(SerializedStream) {
param serializedData: binData;
}
stream<PersonType, tuple<rstring label>> DeserializedStream2 = Deserializer(SerializedStream) {
param
serializedData: binData;
output DeserializedStream2:
firstName = deserialized(0),
lastName = deserialized(1),
age = deserialized(2)
label = "deserialized";
}
}
Summary
- Ports
- This operator has 1 input port and 1 output port.
- Windowing
- This operator does not accept any windowing configurations.
- Parameters
- This operator supports 1 parameter.
Required: serializedData
- Metrics
- This operator does not report any metrics.
Properties
- Implementation
- C++
- Threading
- Always - Operator always provides a single threaded execution context.
- Ports (0)
-
The input port receives the input data to de-serialize in a single attribute of type blob. See parameter serializedData.
- Properties
-
- Optional: false
- ControlPort: false
- TupleMutationAllowed: false
- WindowingMode: NonWindowed
- WindowPunctuationInputMode: Oblivious
- Assignments
- This operator allows any SPL expression of the correct type to be assigned to output attributes.
- Output Functions
-
- DeserializationFunctions
-
- <any T> T AsIs(T)
-
The default function for output attributes. This function assigns the output attribute to the value of the input attribute with the same name.
- <any T> T deserialized(int32 i)
-
De-serialized data attribute with index i. The index starts with zero. The index parameter i must be a single compile time constant literal.
- Ports (0)
-
If no output clause is present in the operator invocation, all output tuple attributes are designated for de-serialization.
- Properties
-
- Optional: false
- TupleMutationAllowed: true
- WindowPunctuationOutputMode: Free
Required: serializedData
- serializedData
-
This parameter specifies the name of the attribute with the serialized data. The attribute must be of type blob.
- Properties
-
- Type: blob
- Cardinality: 1
- Optional: false
- ExpressionMode: Attribute
- Deserializer
-
stream<${schema}> ${outputStream} = com.teracloud.streams.inet.util::Deserializer(${inputStream}) { param serializedData: ${inputStreamBlobAttribute}; output ${outputStream}: ${outputAttribute} = ${value}; }