Class PartitionCustomKeySelector
- java.lang.Object
-
- org.apache.flink.streaming.api.functions.python.PartitionCustomKeySelector
-
- All Implemented Interfaces:
Serializable
,Function
,KeySelector<Row,Integer>
@Internal public class PartitionCustomKeySelector extends Object implements KeySelector<Row,Integer>
ThePartitionCustomKeySelector
will return the first field of the input row value. The value of the first field is the desired partition index which is computed according to user defined partitioner and keySelector function.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PartitionCustomKeySelector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Integer
getKey(Row value)
User-defined function that deterministically extracts the key from an object.
-
-
-
Method Detail
-
getKey
public Integer getKey(Row value) throws Exception
Description copied from interface:KeySelector
User-defined function that deterministically extracts the key from an object.For example for a class:
public class Word { String word; int count; }
The key extractor could return the word as a key to group all Word objects by the String they contain.
The code would look like this
public String getKey(Word w) { return w.word; }
- Specified by:
getKey
in interfaceKeySelector<Row,Integer>
- Parameters:
value
- The object to get the key from.- Returns:
- The extracted key.
- Throws:
Exception
- Throwing an exception will cause the execution of the respective task to fail, and trigger recovery or cancellation of the program.
-
-