-
- All Known Implementing Classes:
HashPartitioningFunction
,HBasePartitioningFunction
,RangePartitioningFunction
public interface PartitioningFunction
Represents a pluggable partitioning function; for use by operators that require custom partitioning
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
PartitioningFunction.Evaluator
Computes partition assignments for each row if input
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PartitioningFunction.Evaluator
getEvaluator(PartitioningFunctionContext ctx)
Create an Evaluator bound to the specified context.boolean
isEquivalentPartitioning(PartitioningFunction other)
Returns true iff, given a single row of input, this function is guaranteed to produce the same partitioning as the other function.boolean
isFunctionOfInput()
Returns true iff, given two identical rows of input, this function will return the same value.PartitioningFunction
remapFieldReferences(Map<String,String> oldToNewMapping)
Creates a new function, equivalent to the given function, but with all field references renamed according to the given mapping.void
validateForType(RecordTokenType type)
Performs validation of the specified input type
-
-
-
Method Detail
-
getEvaluator
PartitioningFunction.Evaluator getEvaluator(PartitioningFunctionContext ctx)
Create an Evaluator bound to the specified context.- Parameters:
ctx
- the partitioning context- Returns:
- an Evaluator bound to the specified context.
-
validateForType
void validateForType(RecordTokenType type)
Performs validation of the specified input type- Parameters:
type
- the input type
-
isFunctionOfInput
boolean isFunctionOfInput()
Returns 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)
- Returns:
- whether this function is a stateless, deterministic function of input
-
isEquivalentPartitioning
boolean isEquivalentPartitioning(PartitioningFunction other)
Returns 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 withisFunctionOfInput()
, this function must return false ifisFunctionOfInput()
returns false.- Parameters:
other
- the other function- Returns:
- whether this function produces the same results as the other function.
-
remapFieldReferences
PartitioningFunction remapFieldReferences(Map<String,String> oldToNewMapping)
Creates a new function, equivalent to the given function, but with all field references renamed according to the given mapping.- 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
-
-