public class First extends ExtentBase
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.fieldDeclaration, numArgs, trace
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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) |
aggregate, equals, getIgnoreTuples, getResult, hashCode, prepare, start
cleanup, flush, getFieldDeclaration, getNumArgs, getTrace, isSafe, printOperationInternal, toString, toStringInternal
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
cleanup, flush, getFieldDeclaration, getNumArgs, isSafe
public First()
@ConstructorProperties(value="firstN") public First(int firstN)
firstN
- of type int@ConstructorProperties(value="fieldDeclaration") public First(Fields fieldDeclaration)
fieldDeclaration
- of type Fields@ConstructorProperties(value={"fieldDeclaration","firstN"}) public First(Fields fieldDeclaration, int firstN)
fieldDeclaration
- of type FieldsfirstN
- of type int@ConstructorProperties(value={"fieldDeclaration","ignoreTuples"}) public First(Fields fieldDeclaration, Tuple... ignoreTuples)
fieldDeclaration
- of type FieldsignoreTuples
- of type Tuple...public int getFirstN()
protected void performOperation(Tuple[] context, TupleEntry entry)
performOperation
in class ExtentBase
public void complete(FlowProcess flowProcess, AggregatorCall<Tuple[]> aggregatorCall)
Aggregator
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.complete
in interface Aggregator<Tuple[]>
complete
in class ExtentBase
flowProcess
- of type FlowProcessaggregatorCall
- of type AggregatorCallCopyright © 2007-2015 Concurrent, Inc. All Rights Reserved.