- java.lang.Object
-
- com.pervasive.datarush.operators.AbstractLogicalOperator
-
- com.pervasive.datarush.operators.StreamingOperator
-
- com.pervasive.datarush.operators.DeferredCompositeOperator
-
- All Implemented Interfaces:
LogicalOperator
- Direct Known Subclasses:
AbstractDeferredRecordOperator
,ErrorSink
,ErrorSource
,ForceStaging
,MergeModel
,SimulatePartitions
,UnionAll
public abstract class DeferredCompositeOperator extends StreamingOperator
For rare use cases; implementors should useCompositeOperator
whenever possible! Similar toCompositeOperator
in that this is composed of sub-operators. The key distinction, though, is that composition is deferred until execution time such thatcompose(DeferredCompositionContext)
is invoked on a per-partition basis. Thus, subclasses of this class control input partitioning and output partitioning declaration. Beware that input partitioning requirements effectively override those that the components may have declared by-default, thus it is preferable to useCompositeOperator
if possible. In addition be aware of the following restrictions:- DeferredCompositeOperator must not contain any iterative operators
- DeferredCompositeOperator must not contain any operators that force staging
- If any sub-operators declare metadata requirements they are treated as assertions (rather than being automatically fulfilled by the framework). Thus, it is the responsibility of DeferredCompositeOperator to ensure than any metadata requirements are fulfilled.
-
-
Constructor Summary
Constructors Constructor Description DeferredCompositeOperator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
compose(DeferredCompositionContext ctx)
Compose the body of this operator.protected abstract void
computeMetadata(StreamingMetadataContext ctx)
Implementations must adhere to all of the contracts specified byStreamingOperator.computeMetadata(com.pervasive.datarush.operators.StreamingMetadataContext)
.protected void
computeOutputTypes(StreamingMetadataContext ctx)
Convenience method that implementations ofcomputeMetadata
may use in order to compute the output types.-
Methods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
-
-
-
-
Method Detail
-
computeMetadata
protected abstract void computeMetadata(StreamingMetadataContext ctx)
Implementations must adhere to all of the contracts specified byStreamingOperator.computeMetadata(com.pervasive.datarush.operators.StreamingMetadataContext)
. In addition, DeferredCompositeOperators must declare required metadata so as to satisfy requirements of the operators that are added duringcompose(com.pervasive.datarush.operators.DeferredCompositionContext)
.- Specified by:
computeMetadata
in classStreamingOperator
- Parameters:
ctx
- the context
-
computeOutputTypes
protected final void computeOutputTypes(StreamingMetadataContext ctx)
Convenience method that implementations ofcomputeMetadata
may use in order to compute the output types. Beware that this method is implemented by invokingcompose(com.pervasive.datarush.operators.DeferredCompositionContext)
on the client in order to get the output types. Thus, operators whose compose method performs some machine-specific operation (i.e. validating the existence of a file on a machine in the cluster) should not invoke this method.- Parameters:
ctx
- the context
-
compose
protected abstract void compose(DeferredCompositionContext ctx)
Compose the body of this operator. Implementations should do the following:- Instantiate and configure sub-operators, adding them to the provided context via
the method
OperatorComposable.add(O)
- Create necessary connections via the method
OperatorComposable.connect(P, P)
. This includes connections from the composite's input ports to sub-operators, connections between sub-operators, and connections from sub-operators output ports to the composite's output ports
- Parameters:
ctx
- the context
- Instantiate and configure sub-operators, adding them to the provided context via
the method
-
-