Operator Import
SPL standard and specialized toolkits > spl 1.2.1 > spl.adapter > Import
The Import operator receives tuples from streams that are made available by Export operators of applications that are running in the same streaming middleware instance.
Import streams are matched to Export streams. The match can be done by subscription or properties or by streamId name.
The Import operator does not generate tuples inside stand-alone SPL applications.
The Import operator does not allow a config clause to be specified.
The Import operator behaves as multiple streams when connected to an input port that is punctuation-expecting.
Checkpointed data
The Import operator does not support checkpointing.
Behavior in a consistent region
The Import operator is not supported in a consistent region.
Checkpointing behavior in an autonomous region
The Import operator does not allow config checkpoint clause to be specified.
Examples
This example uses the Import operator.
composite Main {
type SomeTupleType = int32 x;
graph
stream<SomeTupleType> I2 = Import() {
param applicationScope : "myApplicationScope";
//application scope selected when exporting application launched
applicationName : "some.nameSpace::MainOp";
//main operator selected when exporting application launched
streamId : "StreamName";
//outside-in name in case of nested composite invokes
}
stream<SomeTupleType> TechBargains = Import() {
param subscription : kind == "bargains" && category == "tech";
}
}
Summary
- Ports
- This operator has 0 input ports and 1 output port.
- Windowing
- This operator does not accept any windowing configurations.
- Parameters
- This operator supports 5 parameters.
Required: subscription
Optional: applicationName, applicationScope, streamId, filter
- Metrics
- This operator does not report any metrics.
Properties
- Implementation
- C++
- Threading
- Always - Operator always provides a single threaded execution context.
- Assignments
- This operator does not allow assignments to output attributes.
- Ports (0)
-
The Import operator has a single output port, which produces tuples from the imported streams.
- Properties
-
- Optional: false
- TupleMutationAllowed: false
- WindowPunctuationOutputMode: Generating
- subscription
Specifies the subscription expression that is used to specify the streams to be imported. The parameter can be a boolean or rstring predicate. The predicate refers to names that are defined by the properties of any Export operator within the Import operator's application scope and with a matching schema.
If the parameter is an rstring, it must be a compile-time constant value. The subscription parameter can accept a subscriptionExpression with:- nameOptionalSubscript relationalOperator literal
- literal in splIdentifer
- nameOptionalSubscript % int64Literal relationalOperator int64Literal
- subscriptionExpression ( '&&' subscriptionExpression) *
- subscriptionExpression ( '||' subscriptionExpression) *
- '(' subscriptionExpression ')'
- nameOptionalSubscript is an splIdentifier ('[' intLiteral ']')?.
- relationalOperator is one of ==, !=, >, >=, <, or <=.
- literal is an rstring, float64, or int64 literal value.
- splIdentifier is an SPL identifier.
For example:param subscription : (a == "hi") && ("x" in b || g\[4\] > 6.7 || id % 8 == 3)
If the application has user-defined parallelism and the Import operator is replicated in a parallel region, you can use the getChannel() and getMaxChannels() SPL built-in functions in this parameter. The functions are evaluated when the job is submitted.
- Properties
-
- Cardinality: 1
- Optional: false
- ExpressionMode: Expression
- applicationName
Specifies the name of the application from which the stream is imported. This parameter is valid only when you specify the streamId parameter.
If the parameter is not specified, the fully qualified name of the main composite is used. For example, [namespace::] compositeName.
- Properties
-
- Type: rstring
- Cardinality: 1
- Optional: true
- ExpressionMode: Constant
- applicationScope
Specifies the application scope that is selected when the exporting application starts. If this parameter is not specified, the application scope is "Default".
- Properties
-
- Type: rstring
- Cardinality: 1
- Optional: true
- ExpressionMode: Constant
- streamId
Specifies the external name of the stream that is being imported. You cannot specify both the streamId and the subscription parameter in an Import operator.
If neither the streamId nor subscription parameters are provided, the Import operator is a subscription import with an empty subscription that does not match any Export properties.
If the application has user-defined parallelism and the Import operator is replicated in a parallel region, you can use the getChannel() and getMaxChannels() SPL built-in functions in this parameter. The functions are evaluated when the job is submitted.
- Properties
-
- Type: rstring
- Cardinality: 1
- Optional: true
- ExpressionMode: Constant
- filter
Specifies the dynamic filter expression that is used to filter tuples from the Export operator. The parameter value has a boolean or rstring data type. Valid filter expressions use the same expression syntax that the subscription parameter expression accepts, but the symbols must be attributes in the output string schema.
If the parameter has an rstring data type, it is parsed in the same way as an rstring of the subscription parameter. If a filter parameter is present, the Import operator submits downstream only the exported tuples for which the filterExpression evaluates to true.
The filter parameter can accept a filterExpression with:- nameOptionalSubscript relationalOperator literal
- literal in splIdentifer
- nameOptionalSubscript % int64Literal relationalOperator int64Literal
- filterExpression ( '&&' filterExpression) *
- filterExpression ( '||' filterExpression) *
- '(' filterExpression ')'
- nameOptionalSubscript is an splIdentifier ('[' intLiteral ']')?.
- relationalOperator is one of ==, !=, >, >=, <, or <=.
- literal is an rstring, float64, or int64 literal value.
- splIdentifier is an attribute in the output stream of the Import operator. If there is no subscript, it must have type int64, rstring, or float64. If it is subscripted, it must have type list<int64>, list<rstring>, or list<float64>.
If the application has user-defined parallelism and the Import operator is replicated in a parallel region, you can use the getChannel() and getMaxChannels() SPL built-in functions in this parameter. The functions are evaluated when the job is submitted.
- Properties
-
- Cardinality: 1
- Optional: true
- ExpressionMode: Expression
- Import by Stream ID
-
stream<${schema}> ${outputStream} = Import() { param applicationName : "${mainCompositeName}"; streamId : "${streamName}"; }
- Import by Subscription
-
stream<${schema}> ${outputStream} = Import() { param subscription : ${subscriptionCondition}; }
- Import by Subscription with Filter
-
stream<${schema}> ${outputStream} = Import() { param subscription : ${subscriptionCondition}; filter : ${filterCondition}; }