public final class ExternalRecordSink extends ExecutableOperator implements RecordSinkOperator
LogicalGraphInstance#start()
. For example:
//create the graphLogicalGraph
graph= LogicalGraphFactory.newLogicalGraph(); //add some operators to the graph op= graph.add(...); //add the external sink to the graph ExternalRecordSink sink= graph.add
(new ExternalRecordSink()); //connect the input to the sink graph.connect
(op.getOutput(), sink.getInput()); //compile the graphLogicalGraphInstance
instance= graph.compile
(); //*always* call start to start in background, not run since run will deadlock!! instance.start
(); //process the sink results in this thread RecordInput rec= sink.getOutput(); while ( rec.stepNext() ) { ... } //after processing all results, join on the graph //don't join before since it will deadlock! instance.join
();
NOTE: this operator is non-parallel
Constructor and Description |
---|
ExternalRecordSink()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected ExecutableOperator |
cloneForExecution()
Performs a deep copy of the operator for execution.
|
protected void |
computeMetadata(StreamingMetadataContext ctx)
Implementations must adhere to the following contracts
|
protected void |
execute(ExecutionContext ctx)
Executes the operator.
|
RecordPort |
getInput()
Gets the record port providing the input data to the sink.
|
RecordInput |
getOutput()
Returns the external port that an external application can use to receive
data from this sink.
|
boolean |
isIgnoreSortOrder()
If set to true, the sink will return records in any order.
|
protected void |
notifyError(Throwable e)
Called to notify the operator that the graph terminated abnormally
either before the operator had a chance to run or while the operator
is running.
|
void |
setIgnoreSortOrder(boolean ignoreSortOrder)
If set to true, the sink will return records in any order.
|
getNumInputCopies, getPortSettings, handleInactiveOutput
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
disableParallelism, getInputPorts, getOutputPorts
public ExternalRecordSink()
public RecordPort getInput()
RecordSinkOperator
getInput
in interface RecordSinkOperator
getInput
in interface SinkOperator<RecordPort>
public boolean isIgnoreSortOrder()
public void setIgnoreSortOrder(boolean ignoreSortOrder)
ignoreSortOrder
- whether to ignore sort order.public RecordInput getOutput()
protected void computeMetadata(StreamingMetadataContext ctx)
StreamingOperator
StreamingMetadataContext.parallelize(ParallelismStrategy)
.
RecordPort#setRequiredDataOrdering
, otherwise data may arrive in any order.
RecordPort#setRequiredDataDistribution
, otherwise data will arrive in an unspecified partial distribution
.
RecordPort#getSourceDataDistribution
and RecordPort#getSourceDataOrdering
. These should be
viewed as a hints to help chose a more efficient algorithm. In such cases, though, operators must
still declare data ordering and data distribution requirements; otherwise there is no guarantee that
data will arrive sorted/distributed as required.
RecordPort#setType
.RecordPort#setOutputDataOrdering
RecordPort#setOutputDataDistribution
AbstractModelPort#setMergeHandler
.MergeModel
is a convenient, re-usable model reducer, parameterized with
a merge-handler.
SimpleModelPort
's have no associated metadata and therefore there is
never any output metadata to declare. PMMLPort
's, on the other hand,
do have associated metadata. For all PMMLPorts, implementations must declare
the following:
PMMLPort.setPMMLModelSpec
.
computeMetadata
in class StreamingOperator
ctx
- the contextprotected void notifyError(Throwable e)
AbstractLogicalOperator
CompositeOperator
, this method will
be invoked if any of the componentsnotifyError
in class AbstractLogicalOperator
e
- the error that occuredprotected ExecutableOperator cloneForExecution()
ExecutableOperator
cloneForExecution
in class ExecutableOperator
protected void execute(ExecutionContext ctx)
ExecutableOperator
execute
in class ExecutableOperator
ctx
- context in which to lookup physical ports bound to logical portsCopyright © 2021 Actian Corporation. All rights reserved.