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

org.apache.crunch.fn
Class SPairFlatMapFunction<T,K,V>

java.lang.Object
  extended by org.apache.crunch.DoFn<T,R>
      extended by org.apache.crunch.fn.SPairFlatMapFunction<T,K,V>
All Implemented Interfaces:
Serializable, org.apache.spark.api.java.function.PairFlatMapFunction<T,K,V>

public abstract class SPairFlatMapFunction<T,K,V>
extends DoFn<T,R>
implements org.apache.spark.api.java.function.PairFlatMapFunction<T,K,V>

A Crunch-compatible abstract base class for Spark's PairFlatMapFunction. Subclasses of this class may be used against either Crunch PCollections or Spark RDDs.

See Also:
Serialized Form

Constructor Summary
SPairFlatMapFunction()
           
 
Method Summary
 void cleanup(Emitter<R> emitter)
          Called during the cleanup of the MapReduce job this DoFn is associated with.
 void initialize()
          Initialize this DoFn.
 void process(T input, Emitter<Pair<K,V>> emitter)
          Processes the records from a PCollection.
 
Methods inherited from class org.apache.crunch.DoFn
configure, disableDeepCopy, scaleFactor, setConfiguration, setContext
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.spark.api.java.function.PairFlatMapFunction
call
 

Constructor Detail

SPairFlatMapFunction

public SPairFlatMapFunction()
Method Detail

process

public void process(T input,
                    Emitter<Pair<K,V>> emitter)
Description copied from class: DoFn
Processes the records from a PCollection.

Note: Crunch can reuse a single input record object whose content changes on each DoFn.process(Object, Emitter) method call. This functionality is imposed by Hadoop's Reducer implementation: The framework will reuse the key and value objects that are passed into the reduce, therefore the application should clone the objects they want to keep a copy of.

Specified by:
process in class DoFn<T,Pair<K,V>>
Parameters:
input - The input record.
emitter - The emitter to send the output to

initialize

public final 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<T,R>

cleanup

public final void cleanup(Emitter<R> emitter)
Description copied from class: DoFn
Called during the cleanup of the MapReduce job this DoFn is associated with. Subclasses may override this method to do appropriate cleanup.

Overrides:
cleanup in class DoFn<T,R>
Parameters:
emitter - The emitter that was used for output


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.