java.lang.Object
com.pervasive.datarush.ports.record.DataOrdering
DataOrdering is the component of
RecordMetadata that describes how
the data is ordered.
Operators may declare a required ordering by calling RecordPort.setRequiredDataOrdering(com.pervasive.datarush.operators.MetadataCalculationContext, com.pervasive.datarush.ports.record.DataOrdering).
It is the responsibility of the framework to ensure that the specified requirement is met.
Operators may also declare their output ordering by calling RecordPort.setOutputDataDistribution(com.pervasive.datarush.operators.MetadataCalculationContext, com.pervasive.datarush.ports.record.DataDistribution).
This lets the framework know how data is ordered on the operator's output. If there is
an mismatch between required and provided metadata, the framework will automatically sort
as needed.
- See Also:
-
StreamingOperator#computeMetadataIterativeOperator#computeMetadata
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DataOrderingThe default data ordering if not specified. -
Constructor Summary
ConstructorsConstructorDescriptionDataOrdering(SortKey[] keys) Specify that data is ordered by the given set of keys.DataOrdering(List<SortKey> keys) Specify that data is ordered by the given set of keys. -
Method Summary
Modifier and TypeMethodDescriptionAliasSet[]SortKey[]getKeys()Returns the keys that the data is sorted bySortKey[]getPrefixOrdering(String[] prefix) Returns a prefix of the current ordering, merged with sort direction information.booleanReturns true if data is ordered by the specified ordering or a prefix of the specified ordering.booleanReturns true if data is ordered by the specified ordering or a prefix of the specified ordering.booleanReturns whether this is the unspecified data ordering.remap(FieldRemapping mapping) Applies the given field remapping to this ordering, changing names as required.toString()
-
Field Details
-
UNSPECIFIED
The default data ordering if not specified.
-
-
Constructor Details
-
DataOrdering
Specify that data is ordered by the given set of keys.- Parameters:
keys- specifies field names and ascending vs. descending
-
DataOrdering
Specify that data is ordered by the given set of keys.- Parameters:
keys- specifies field names and ascending vs. descending
-
-
Method Details
-
isOrdered
Returns true if data is ordered by the specified ordering or a prefix of the specified ordering.- Parameters:
desired- the desired data ordering- Returns:
- whether the data is ordered by the desired ordering
-
isOrdered
Returns true if data is ordered by the specified ordering or a prefix of the specified ordering. This method ignores ascending vs. descending order. If ascending vs. descending is important useisOrdered(SortKey[])instead.- Parameters:
desired- the desired data ordering- Returns:
- whether the data is ordered by the desired ordering
-
getAliases
-
getKeys
Returns the keys that the data is sorted by- Returns:
- the keys the date data is sorted by
-
isUnspecified
public boolean isUnspecified()Returns whether this is the unspecified data ordering. The unspecified data ordering is equivalent to an ordering where there are no sort keys.- Returns:
- whether this is the unspecified data ordering
-
getPrefixOrdering
Returns a prefix of the current ordering, merged with sort direction information. This is useful for operators that require data be sorted by a specific set of keys but have no specific requirements regarding sort direction. Those operators will first need to test whether data is ordered as desired by callingisOrdered(String[]). If data is ordered, they will then call this method to determine specific directional information.- Parameters:
prefix- must be a prefix of the data ordering- Returns:
- a prefix of the current ordering.
- Throws:
IllegalArgumentException- if the data is not ordered by the given prefix
-
remap
Applies the given field remapping to this ordering, changing names as required. If any sort keys refer to columns that are dropped as part of the rename, the result ordering will be a prefix of the original. If all sort keys refer to columns that are dropped via the rename, the result will be theUNSPECIFIEDordering.- Parameters:
mapping- the field remapping.- Returns:
- this distribution, remapped to the new names.
-
toString
-