This project has retired. For details please refer to its Attic page.
Aggregate.TopKFn (Apache Crunch 0.3.0-incubating API)

org.apache.crunch.lib
Class Aggregate.TopKFn<K,V>

java.lang.Object
  extended by org.apache.crunch.DoFn<Pair<K,V>,Pair<Integer,Pair<K,V>>>
      extended by org.apache.crunch.lib.Aggregate.TopKFn<K,V>
All Implemented Interfaces:
Serializable
Enclosing class:
Aggregate

public static class Aggregate.TopKFn<K,V>
extends DoFn<Pair<K,V>,Pair<Integer,Pair<K,V>>>

See Also:
Serialized Form

Constructor Summary
Aggregate.TopKFn(int limit, boolean ascending)
           
 
Method Summary
 void cleanup(Emitter<Pair<Integer,Pair<K,V>>> emitter)
          Called during the cleanup of the MapReduce job this DoFn is associated with.
 void initialize()
          Called during the setup of the MapReduce job this DoFn is associated with.
 void process(Pair<K,V> input, Emitter<Pair<Integer,Pair<K,V>>> emitter)
          Processes the records from a PCollection.
 
Methods inherited from class org.apache.crunch.DoFn
configure, scaleFactor, setConfigurationForTest, setContext
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Aggregate.TopKFn

public Aggregate.TopKFn(int limit,
                        boolean ascending)
Method Detail

initialize

public void initialize()
Description copied from class: DoFn
Called during the setup of the MapReduce job this DoFn is associated with. Subclasses may override this method to do appropriate initialization.

Overrides:
initialize in class DoFn<Pair<K,V>,Pair<Integer,Pair<K,V>>>

process

public void process(Pair<K,V> input,
                    Emitter<Pair<Integer,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<Pair<K,V>,Pair<Integer,Pair<K,V>>>
Parameters:
input - The input record.
emitter - The emitter to send the output to

cleanup

public void cleanup(Emitter<Pair<Integer,Pair<K,V>>> 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<Pair<K,V>,Pair<Integer,Pair<K,V>>>
Parameters:
emitter - The emitter that was used for output


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