- java.lang.Object
-
- com.pervasive.datarush.ports.record.RangePartitioningFunction
-
- All Implemented Interfaces:
PartitioningFunction
public final class RangePartitioningFunction extends Object implements PartitioningFunction
A partitioning function that partitions records of data based on specified ranges.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.pervasive.datarush.ports.record.PartitioningFunction
PartitioningFunction.Evaluator
-
-
Constructor Summary
Constructors Constructor Description RangePartitioningFunction(String key, List<? extends ScalarToken> values)Range partitions based on a single keyRangePartitioningFunction(List<RecordToken> values)Range partitions based on multiple keys.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<RecordToken>getBoundaries()Returns the boundaries to partition onRecordTokenTypegetBoundaryType()Returns the boundary type determined by the widest type of all boundariesPartitioningFunction.EvaluatorgetEvaluator(PartitioningFunctionContext ctx)Create an Evaluator bound to the specified context.booleanisEquivalentPartitioning(PartitioningFunction other)Returns true iff, given a single row of input, this function is guaranteed to produce the same partitioning as the other function.booleanisFunctionOfInput()Returns true iff, given two identical rows of input, this function will return the same value.RangePartitioningFunctionremapFieldReferences(Map<String,String> oldToNewMapping)Creates a new function, equivalent to the given function, but with all field references renamed according to the given mapping.voidvalidateForType(RecordTokenType type)Performs validation of the specified input type
-
-
-
Constructor Detail
-
RangePartitioningFunction
public RangePartitioningFunction(String key, List<? extends ScalarToken> values)
Range partitions based on a single key- Parameters:
key- the keyvalues- the boundary values for the key
-
RangePartitioningFunction
public RangePartitioningFunction(List<RecordToken> values)
Range partitions based on multiple keys. The list of records correspond to each boundary and the elements in each record correspond to each key. All records must have the same names.- Parameters:
values- the values to partition on
-
-
Method Detail
-
getBoundaries
public List<RecordToken> getBoundaries()
Returns the boundaries to partition on- Returns:
- the boundaries
-
getBoundaryType
public RecordTokenType getBoundaryType()
Returns the boundary type determined by the widest type of all boundaries- Returns:
- the boundary type
-
validateForType
public void validateForType(RecordTokenType type)
Description copied from interface:PartitioningFunctionPerforms validation of the specified input type- Specified by:
validateForTypein interfacePartitioningFunction- Parameters:
type- the input type
-
getEvaluator
public PartitioningFunction.Evaluator getEvaluator(PartitioningFunctionContext ctx)
Description copied from interface:PartitioningFunctionCreate an Evaluator bound to the specified context.- Specified by:
getEvaluatorin interfacePartitioningFunction- Parameters:
ctx- the partitioning context- Returns:
- an Evaluator bound to the specified context.
-
isEquivalentPartitioning
public boolean isEquivalentPartitioning(PartitioningFunction other)
Description copied from interface:PartitioningFunctionReturns true iff, given a single row of input, this function is guaranteed to produce the same partitioning as the other function. A return of true thus implies the following:- both functions are deterministic
- both function are stateless (not sensitive to previous values read or to input ordering)
In addition, in order to be consistent withPartitioningFunction.isFunctionOfInput(), this function must return false ifPartitioningFunction.isFunctionOfInput()returns false.- Specified by:
isEquivalentPartitioningin interfacePartitioningFunction- Parameters:
other- the other function- Returns:
- whether this function produces the same results as the other function.
-
isFunctionOfInput
public boolean isFunctionOfInput()
Description copied from interface:PartitioningFunctionReturns true iff, given two identical rows of input, this function will return the same value. A return of true thus implies :- the function is deterministic
- the function is stateless (not sensitive to previous values read or to input ordering)
- Specified by:
isFunctionOfInputin interfacePartitioningFunction- Returns:
- whether this function is a stateless, deterministic function of input
-
remapFieldReferences
public RangePartitioningFunction remapFieldReferences(Map<String,String> oldToNewMapping)
Description copied from interface:PartitioningFunctionCreates a new function, equivalent to the given function, but with all field references renamed according to the given mapping.- Specified by:
remapFieldReferencesin interfacePartitioningFunction- Parameters:
oldToNewMapping- a mapping from old names to new names. If a name is not present in the given mapping, it will remain as-is.- Returns:
- a new function with all field reference renamed appropriately
-
-