- java.lang.Object
-
- com.pervasive.datarush.ports.LogicalPort
-
- com.pervasive.datarush.ports.record.RecordPort
-
public final class RecordPort extends LogicalPort
Defines a logical record port.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.pervasive.datarush.ports.LogicalPort
LogicalPort.Direction
-
-
Field Summary
Fields Modifier and Type Field Description static LogicalPortFactory<RecordPort>
FACTORY
The singleton for creating record ports.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RecordPort
filtered(LogicalSubgraph subgraph, RecordPortOptions options)
Returns a new record port that is a filtered view of this record port.DataDistribution
getCombinedDataDistribution(MetadataContext ctx)
Gets the required data distribution of this portDataOrdering
getCombinedDataOrdering(MetadataContext ctx)
Gets the required data ordering of this portRecordMetadata
getCombinedMetadata(MetadataContext ctx)
Returns the actual metadata that the operator will see given its current requirements and parallelism setting.LogicalPortFactory<?>
getFactory()
Returns the factory that knows how to create ports of this typeRecordInput
getInput(ExecutionContext ctx)
Returns the physical input port associated with this logical input port.RecordInput
getInput(ExecutionContext ctx, int copyNumber)
Returns the physical input port associated with the specified copy number of this logical input port.Class<RecordMetadata>
getMetadataType()
Returns the class of metadata that this port usesRecordOutput
getOutput(ExecutionContext ctx)
Returns the physical output port associated with this logical output port.DataDistribution
getRequiredDataDistribution(MetadataContext ctx)
Gets the required data distribution of this portDataOrdering
getRequiredDataOrdering(MetadataContext ctx)
Gets the required data ordering of this portRecordMetadata
getRequiredMetadata(MetadataContext ctx)
Returns the required metadata associated with this portDataDistribution
getSourceDataDistribution(MetadataContext ctx)
Returns source data distribution associated with this input port.DataOrdering
getSourceDataOrdering(MetadataContext ctx)
Returns source data ordering associated with this input port.RecordMetadata
getSourceMetadata(MetadataContext ctx)
Returns the metadata associated with this portRecordTokenType
getType(MetadataContext ctx)
Returns the record type of this port.void
setIterationStagingOptions(IterativeMetadataContext ctx, DatasetOptions options)
Sets the staging options for this input port.void
setOutputDataDistribution(MetadataCalculationContext ctx, DataDistribution distribution)
Sets the data partitioning associated with the given record port.void
setOutputDataOrdering(MetadataCalculationContext ctx, DataOrdering ordering)
Sets the data ordering associated with this output port.void
setRequiredDataDistribution(MetadataCalculationContext ctx, DataDistribution distribution)
Sets the required data distribution of this input port.void
setRequiredDataOrdering(MetadataCalculationContext ctx, DataOrdering ordering)
Sets the required data ordering of the given input.void
setType(MetadataCalculationContext ctx, RecordTokenType type)
Sets the type associated with this port.-
Methods inherited from class com.pervasive.datarush.ports.LogicalPort
getDirection, getName, getOwner, isOptional, toString
-
-
-
-
Field Detail
-
FACTORY
public static final LogicalPortFactory<RecordPort> FACTORY
The singleton for creating record ports.
-
-
Method Detail
-
getSourceMetadata
public RecordMetadata getSourceMetadata(MetadataContext ctx)
Returns the metadata associated with this port- Parameters:
ctx
- context used to resolve metadata- Returns:
- the metadata associated with this port
-
getRequiredMetadata
public RecordMetadata getRequiredMetadata(MetadataContext ctx)
Returns the required metadata associated with this port- Parameters:
ctx
- context used to resolve metadata- Returns:
- the required metadata associated with this port
-
getCombinedMetadata
public RecordMetadata getCombinedMetadata(MetadataContext ctx)
Returns the actual metadata that the operator will see given its current requirements and parallelism setting.- Parameters:
ctx
- context used to resolve metadata- Returns:
- the combined metadata associated with this port
-
getSourceDataOrdering
public DataOrdering getSourceDataOrdering(MetadataContext ctx)
Returns source data ordering associated with this input port. This should be viewed as a hint to operator implementations that may chose a more efficient algorithm depending on the ordering of the input data. Note that in such a case, operators must declare sorting requirements viasetRequiredDataOrdering(com.pervasive.datarush.operators.MetadataCalculationContext, com.pervasive.datarush.ports.record.DataOrdering)
, otherwise the framework is free to provide unsorted data as needed.- Parameters:
ctx
- context used to resolve metadata- Returns:
- the source data ordering associated with this input port
-
getSourceDataDistribution
public DataDistribution getSourceDataDistribution(MetadataContext ctx)
Returns source data distribution associated with this input port. This should be viewed as a hint to operator implementations that may chose a more efficient algorithm depending on the distribution of the input data. Note that in such a case, operators must declare distribution requirements viasetRequiredDataDistribution(com.pervasive.datarush.operators.MetadataCalculationContext, com.pervasive.datarush.ports.record.DataDistribution)
, otherwise the framework is free to redistribute as needed.- Parameters:
ctx
- context used to resolve metadata- Returns:
- the source data distribution associated with this input port
-
setType
public void setType(MetadataCalculationContext ctx, RecordTokenType type)
Sets the type associated with this port.- Parameters:
ctx
- context used to resolve/set metadatatype
- the type of this port.
-
setOutputDataOrdering
public void setOutputDataOrdering(MetadataCalculationContext ctx, DataOrdering ordering)
Sets the data ordering associated with this output port. Prior to calling this method, type must be set by callingsetType(com.pervasive.datarush.operators.MetadataCalculationContext, com.pervasive.datarush.types.RecordTokenType)
.- Parameters:
ctx
- context used to resolve/set metadataordering
- the data ordering
-
setOutputDataDistribution
public void setOutputDataDistribution(MetadataCalculationContext ctx, DataDistribution distribution)
Sets the data partitioning associated with the given record port. Prior to calling this method, type must be set by callingsetType(com.pervasive.datarush.operators.MetadataCalculationContext, com.pervasive.datarush.types.RecordTokenType)
.- Parameters:
ctx
- context used to resolve/set metadatadistribution
- the output distribution
-
setRequiredDataOrdering
public void setRequiredDataOrdering(MetadataCalculationContext ctx, DataOrdering ordering)
Sets the required data ordering of the given input. If unspecified, data ordering will arrive in anunknown
order. Specifically, if an operator declares arequiredDataDistribution
but does not declare arequiredDataOrdering
, data will appear in arbitrary order, regardless of original order, since it is a performance savings to avoid re-sorting data following distribution. In the future there may be additional, similar, optimizations.- Parameters:
ctx
- context used to resolve/set metadataordering
- the required data ordering.
-
setRequiredDataDistribution
public void setRequiredDataDistribution(MetadataCalculationContext ctx, DataDistribution distribution)
Sets the required data distribution of this input port. If unspecified, data distribution will currently match thesourceDataDistribution
, but this behavior is subject to change in the future. Thus, implementations should always declare their input distribution requirements.- Parameters:
ctx
- context used to resolve/set metadatadistribution
- the required data distribution of this input port.
-
filtered
public RecordPort filtered(LogicalSubgraph subgraph, RecordPortOptions options)
Returns a new record port that is a filtered view of this record port. This port must be an input port of an iterative operator. This can provide significant performance boost if only a subset of the iterator's staged columns are needed in each pass.- Parameters:
subgraph
- must be a subgraph created from the same iterative operator.options
- specifies selected columns- Returns:
- a filtered view of this port.
-
setIterationStagingOptions
public void setIterationStagingOptions(IterativeMetadataContext ctx, DatasetOptions options)
Sets the staging options for this input port.- Parameters:
ctx
- context used to resolve/set metadataoptions
- the staging options of this port
-
getRequiredDataOrdering
public DataOrdering getRequiredDataOrdering(MetadataContext ctx)
Gets the required data ordering of this port- Parameters:
ctx
- context used to resolve metadata- Returns:
- the required data ordering of this port
-
getRequiredDataDistribution
public DataDistribution getRequiredDataDistribution(MetadataContext ctx)
Gets the required data distribution of this port- Parameters:
ctx
- context used to resolve metadata- Returns:
- the required data distribution of this port
-
getCombinedDataOrdering
public DataOrdering getCombinedDataOrdering(MetadataContext ctx)
Gets the required data ordering of this port- Parameters:
ctx
- context used to resolve metadata- Returns:
- the required data ordering of this port
-
getCombinedDataDistribution
public DataDistribution getCombinedDataDistribution(MetadataContext ctx)
Gets the required data distribution of this port- Parameters:
ctx
- context used to resolve metadata- Returns:
- the required data distribution of this port
-
getMetadataType
public Class<RecordMetadata> getMetadataType()
Description copied from class:LogicalPort
Returns the class of metadata that this port uses- Specified by:
getMetadataType
in classLogicalPort
- Returns:
- the class of metadata that this port uses
-
getFactory
public LogicalPortFactory<?> getFactory()
Description copied from class:LogicalPort
Returns the factory that knows how to create ports of this type- Specified by:
getFactory
in classLogicalPort
- Returns:
- the factory that knows how to create ports of this type
-
getType
public RecordTokenType getType(MetadataContext ctx)
Returns the record type of this port. This port may either be an input port or an output port.- Parameters:
ctx
- the context in which to lookup type information- Returns:
- the record type of this port
-
getInput
public RecordInput getInput(ExecutionContext ctx)
Returns the physical input port associated with this logical input port.- Parameters:
ctx
- the execution context.- Returns:
- the physical input port associated with this logical input port.
-
getInput
public RecordInput getInput(ExecutionContext ctx, int copyNumber)
Returns the physical input port associated with the specified copy number of this logical input port. This can be used in rare cases when we must examine multiple positions in the same input stream. In order to use this method, operators must also declare an intent to use multiple copies by overriding the methodExecutableOperator#getNumInputCopies
.- Parameters:
ctx
- the execution contextcopyNumber
- the copy number, must be in the range [0,numCopies).- Returns:
- the physical input port
-
getOutput
public RecordOutput getOutput(ExecutionContext ctx)
Returns the physical output port associated with this logical output port.- Parameters:
ctx
- the execution context.- Returns:
- the physical output port associated with this logical output port.
-
-