Operator instance naming conventions
You use operator instance names for debugging and visualization purposes. They are especially useful with operators with multiple output streams because they provide a uniform way to refer to the operator instance.
When you invoke an operator in Streams Processing Language (SPL), give a name to that operator instance. This name is mandatory only when the invoked operator has no output streams.
- Name operator instances when the operator has two or more output streams.
- Operator instances use camel case with the first letter of the identifier capitalized (FilteredNumbers).
- Operator instance names can be a verb or a noun that characterize the transformation that is made by the operator invocation.
When you run an application, all the operators must
have unique names. If the application has user-defined parallelism,
the names of the operators in a parallel region contain the channel
numbers that apply to each of the operators. For example, if a parallel
region is a single primitive operator with the logical name of Operator1
,
the operators in each channel are named Operator1[i]
where i is
the channel number. If the parallel region is a composite operator,
the channel number is displayed after the name of the composite operator,
but before the enclosed name of the operator. For example: Composite1[i].Operator1
.
If an instance name is not specified, the SPL compiler automatically assigns the output stream names as valid operator instance names. For example, operator FileSource in line 5 of the following sample has an instance name of Numbers. Operator instance names are expanded when the operator is not inside a main composite operator. In this case, the operator instance name is appended to the name of the enclosing composite operator instance to form a fully qualified operator instance name.
The following example uses a Filter operator to generate two output streams that are based on the attribute value (attribute number
) of the input stream (Numbers). The operator instance is named FilteredNumbers (line 10), which is semantically related to this specific invocation of the operator Filter.
01: namespace example;
02:
03: composite Main {
04: graph
05: stream<int32 number> Numbers = FileSource() {
06: param file : "input.dat";
07: }
08:
09: (stream<int32 number> Higher10;
10: stream<int32 number> Lower10) as FilteredNumbers = Filter(Numbers) {
11: param filter : number > 10;
12: }
13: }