cascading.operation.aggregator
Class First

java.lang.Object
  extended by cascading.operation.BaseOperation<Tuple[]>
      extended by cascading.operation.aggregator.ExtentBase
          extended by cascading.operation.aggregator.First
All Implemented Interfaces:
DeclaresResults, Aggregator<Tuple[]>, Operation<Tuple[]>, Traceable, Serializable

public class First
extends ExtentBase

Class First is an Aggregator that returns the first Tuple encountered in a grouping.

By default, it returns the first Tuple of Fields.ARGS found.

If firstN is given, Tuples with each of the first N number of Tuples encountered are returned. That is, this Aggregator will return at maximum N tuples per grouping.

Be sure to set the GroupBy sortFields to control which Tuples are seen first.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class cascading.operation.BaseOperation
fieldDeclaration, numArgs, trace
 
Fields inherited from interface cascading.operation.Operation
ANY
 
Constructor Summary
First()
          Selects and returns the first argument Tuple encountered.
First(Fields fieldDeclaration)
          Selects and returns the first argument Tuple encountered.
First(Fields fieldDeclaration, int firstN)
          Selects and returns the first N argument Tuples encountered.
First(Fields fieldDeclaration, Tuple... ignoreTuples)
          Selects and returns the first argument Tuple encountered, unless the Tuple is a member of the set ignoreTuples.
First(int firstN)
          Selects and returns the first N argument Tuples encountered.
 
Method Summary
 void complete(FlowProcess flowProcess, AggregatorCall<Tuple[]> aggregatorCall)
          Method complete will be issued last after every TupleEntry has been passed to the Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall) method.
 int getFirstN()
           
protected  void performOperation(Tuple[] context, TupleEntry entry)
           
 
Methods inherited from class cascading.operation.aggregator.ExtentBase
aggregate, equals, getIgnoreTuples, getResult, hashCode, prepare, start
 
Methods inherited from class cascading.operation.BaseOperation
cleanup, flush, getFieldDeclaration, getNumArgs, getTrace, isSafe, printOperationInternal, toString, toStringInternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cascading.operation.Operation
cleanup, flush, getFieldDeclaration, getNumArgs, isSafe
 

Constructor Detail

First

public First()
Selects and returns the first argument Tuple encountered.


First

@ConstructorProperties(value="firstN")
public First(int firstN)
Selects and returns the first N argument Tuples encountered.

Parameters:
firstN - of type int

First

@ConstructorProperties(value="fieldDeclaration")
public First(Fields fieldDeclaration)
Selects and returns the first argument Tuple encountered.

Parameters:
fieldDeclaration - of type Fields

First

@ConstructorProperties(value={"fieldDeclaration","firstN"})
public First(Fields fieldDeclaration,
                                        int firstN)
Selects and returns the first N argument Tuples encountered.

Parameters:
fieldDeclaration - of type Fields
firstN - of type int

First

@ConstructorProperties(value={"fieldDeclaration","ignoreTuples"})
public First(Fields fieldDeclaration,
                                        Tuple... ignoreTuples)
Selects and returns the first argument Tuple encountered, unless the Tuple is a member of the set ignoreTuples.

Parameters:
fieldDeclaration - of type Fields
ignoreTuples - of type Tuple...
Method Detail

getFirstN

public int getFirstN()

performOperation

protected void performOperation(Tuple[] context,
                                TupleEntry entry)
Specified by:
performOperation in class ExtentBase

complete

public void complete(FlowProcess flowProcess,
                     AggregatorCall<Tuple[]> aggregatorCall)
Description copied from interface: Aggregator
Method complete will be issued last after every TupleEntry has been passed to the Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall) method. Any final calculation should be completed here and passed to the outputCollector.

Specified by:
complete in interface Aggregator<Tuple[]>
Overrides:
complete in class ExtentBase
Parameters:
flowProcess - of type FlowProcess
aggregatorCall - of type AggregatorCall


Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.