org.apache.crunch.fn
Class ExtractKeyFn<K,V>
java.lang.Object
org.apache.crunch.DoFn<S,T>
org.apache.crunch.MapFn<V,Pair<K,V>>
org.apache.crunch.fn.ExtractKeyFn<K,V>
- All Implemented Interfaces:
- Serializable
public class ExtractKeyFn<K,V>
- extends MapFn<V,Pair<K,V>>
Wrapper function for converting a MapFn
into a key-value pair that is
used to convert from a PCollection<V>
to a PTable<K, V>
.
- See Also:
- Serialized Form
Method Summary |
void |
initialize()
Initialize this DoFn. |
Pair<K,V> |
map(V input)
Maps the given input into an instance of the output type. |
void |
setContext(org.apache.hadoop.mapreduce.TaskInputOutputContext<?,?,?,?> context)
Called during setup to pass the TaskInputOutputContext to this
DoFn instance. |
ExtractKeyFn
public ExtractKeyFn(MapFn<V,K> mapFn)
setContext
public void setContext(org.apache.hadoop.mapreduce.TaskInputOutputContext<?,?,?,?> context)
- Description copied from class:
DoFn
- Called during setup to pass the
TaskInputOutputContext
to this
DoFn
instance.
- Overrides:
setContext
in class DoFn<V,Pair<K,V>>
initialize
public void initialize()
- Description copied from class:
DoFn
- Initialize this DoFn. This initialization will happen before the actual
DoFn.process(Object, Emitter)
is triggered. Subclasses may override
this method to do appropriate initialization.
Called during the setup of the job instance this DoFn
is associated
with.
- Overrides:
initialize
in class DoFn<V,Pair<K,V>>
map
public Pair<K,V> map(V input)
- Description copied from class:
MapFn
- Maps the given input into an instance of the output type.
- Specified by:
map
in class MapFn<V,Pair<K,V>>
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.