public class GenericRowDataKeySelector extends Object implements RowDataKeySelector
Constructor and Description |
---|
GenericRowDataKeySelector(InternalTypeInfo<RowData> keyRowType,
RowDataSerializer keySerializer,
GeneratedProjection generatedProjection) |
Modifier and Type | Method and Description |
---|---|
GenericRowDataKeySelector |
copy() |
RowData |
getKey(RowData value)
User-defined function that deterministically extracts the key from an object.
|
InternalTypeInfo<RowData> |
getProducedType()
Gets the data type (as a
TypeInformation ) produced by this function or input format. |
void |
open() |
public GenericRowDataKeySelector(InternalTypeInfo<RowData> keyRowType, RowDataSerializer keySerializer, GeneratedProjection generatedProjection)
public void open()
public RowData getKey(RowData value) throws Exception
KeySelector
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; }
getKey
in interface KeySelector<RowData,RowData>
value
- The object to get the key from.Exception
- Throwing an exception will cause the execution of the respective task to
fail, and trigger recovery or cancellation of the program.public InternalTypeInfo<RowData> getProducedType()
ResultTypeQueryable
TypeInformation
) produced by this function or input format.getProducedType
in interface ResultTypeQueryable<RowData>
getProducedType
in interface RowDataKeySelector
public GenericRowDataKeySelector copy()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.