This project has retired. For details please refer to its Attic page.
ExtractKeyFn (Apache Crunch 0.11.0 API)

org.apache.crunch.fn
Class ExtractKeyFn<K,V>

java.lang.Object
  extended by org.apache.crunch.DoFn<S,T>
      extended by org.apache.crunch.MapFn<V,Pair<K,V>>
          extended by 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

Constructor Summary
ExtractKeyFn(MapFn<V,K> mapFn)
           
 
Method Summary
 void configure(org.apache.hadoop.conf.Configuration conf)
          Configure this DoFn.
 void initialize()
          Initialize this DoFn.
 Pair<K,V> map(V input)
          Maps the given input into an instance of the output type.
 void setConfiguration(org.apache.hadoop.conf.Configuration conf)
          Called during the setup of an initialized PType that relies on this instance.
 void setContext(org.apache.hadoop.mapreduce.TaskInputOutputContext<?,?,?,?> context)
          Called during setup to pass the TaskInputOutputContext to this DoFn instance.
 
Methods inherited from class org.apache.crunch.MapFn
process, scaleFactor
 
Methods inherited from class org.apache.crunch.DoFn
cleanup, disableDeepCopy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtractKeyFn

public ExtractKeyFn(MapFn<V,K> mapFn)
Method Detail

setConfiguration

public void setConfiguration(org.apache.hadoop.conf.Configuration conf)
Description copied from class: DoFn
Called during the setup of an initialized PType that relies on this instance.

Overrides:
setConfiguration in class DoFn<V,Pair<K,V>>
Parameters:
conf - The non-null configuration for the PType being initialized

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. The specified TaskInputOutputContext must not be null.

Overrides:
setContext in class DoFn<V,Pair<K,V>>

configure

public void configure(org.apache.hadoop.conf.Configuration conf)
Description copied from class: DoFn
Configure this DoFn. Subclasses may override this method to modify the configuration of the Job that this DoFn instance belongs to.

Called during the job planning phase by the crunch-client.

Overrides:
configure in class DoFn<V,Pair<K,V>>
Parameters:
conf - The Configuration instance for the Job.

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.