public final class GenerateRandom extends ExecutableOperator implements RecordSourceOperator
All field types except generic and object are supported.
The generated data for each field data type does not in general cover the full range of that type supported by the dataflow system, but does cover a range that any operator claiming to support that type should be able to handle.
Date
, +- 2^64 milliseconds from 1970-01-01,
corresponding to +- about 292 million years.Double
excluding NaN and +-Inf. (NaN values can be generated by setting
nullFraction > 0.0)Float
, excluding NaN and +-Inf. (NaN values can be generated by setting
nullFraction > 0.0)Integer
.Long
.Timestamp
, +- 2^64
milliseconds from 1970-01-01, corresponding to +- about 292 million years. The nanos range is 0 to 999999999. The
time zone offset is a whole number of minute in the range -12:00 to +12:59 (the extra hour is for daylight savings).Constructor and Description |
---|
GenerateRandom()
The default constructor.
|
GenerateRandom(RecordTokenType type,
long rowCount)
Creates a new instance of
GenerateRandom , specifying
the minimal set of required parameters. |
Modifier and Type | Method and Description |
---|---|
protected void |
computeMetadata(StreamingMetadataContext ctx)
Implementations must adhere to the following contracts
|
protected void |
execute(ExecutionContext ctx)
Executes the operator.
|
double |
getNullProbability()
Gets the probability any given generated token will be null valued.
|
RecordPort |
getOutput()
Gets the record port providing the output data from the source.
|
RecordTokenType |
getOutputType()
Returns the data type of the generated values
|
long |
getRowCount()
Returns the number of values to generate
|
long |
getSeed()
Gets the seed for the random number generator.
|
void |
setNullProbability(double nullProbability)
Sets the probability any given generated token will be null valued.
|
void |
setOutputType(RecordTokenType outputType)
Sets the data type of the generated values
|
void |
setRowCount(long rowCount)
Sets the number of values to generate
|
void |
setSeed(long seed)
Sets the seed for the random number generator.
|
cloneForExecution, getNumInputCopies, getPortSettings, handleInactiveOutput
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
disableParallelism, getInputPorts, getOutputPorts
public GenerateRandom()
public GenerateRandom(RecordTokenType type, long rowCount)
GenerateRandom
, specifying
the minimal set of required parameters.type
- the output typerowCount
- the number of rowspublic RecordPort getOutput()
RecordSourceOperator
getOutput
in interface RecordSourceOperator
getOutput
in interface SourceOperator<RecordPort>
public long getSeed()
public double getNullProbability()
public void setSeed(long seed)
seed
- the seed for the random number generatorpublic void setNullProbability(double nullProbability)
nullProbability
- the probability any given generated token will be null valuedpublic RecordTokenType getOutputType()
public void setOutputType(RecordTokenType outputType)
outputType
- the data type of the generated valuespublic long getRowCount()
public void setRowCount(long rowCount)
rowCount
- the number of values to generateprotected 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 execute(ExecutionContext ctx)
ExecutableOperator
execute
in class ExecutableOperator
ctx
- context in which to lookup physical ports bound to logical portsCopyright © 2020 Actian Corporation. All rights reserved.