public class StringAggregator extends java.lang.Object implements Aggregator
Aggregator.Op, Aggregator.TupleMapIterator
Modifier and Type | Field and Description |
---|---|
private int |
aField |
private java.util.HashMap<Field,Tuple> |
fieldTupleMap |
private int |
gbField |
private Type |
gbFieldType |
private Aggregator.Op |
op |
private static long |
serialVersionUID |
private TupleDesc |
tupleDesc |
NO_GROUPING, noGroupField
Constructor and Description |
---|
StringAggregator(int gbfield,
Type gbfieldtype,
int afield,
Aggregator.Op what)
Aggregate constructor
|
Modifier and Type | Method and Description |
---|---|
DbIterator |
iterator()
Create a DbIterator over group aggregate results.
|
void |
mergeTupleIntoGroup(Tuple tup)
Merge a new tuple into the aggregate, grouping as indicated in the constructor
|
private static final long serialVersionUID
private int gbField
private int aField
private Aggregator.Op op
private Type gbFieldType
private TupleDesc tupleDesc
public StringAggregator(int gbfield, Type gbfieldtype, int afield, Aggregator.Op what)
gbfield
- the 0-based index of the group-by field in the tuple, or NO_GROUPING if there is no groupinggbfieldtype
- the type of the group by field (e.g., Type.INT_TYPE), or null if there is no groupingafield
- the 0-based index of the aggregate field in the tuplewhat
- aggregation operator to use -- only supports COUNTjava.lang.IllegalArgumentException
- if what != COUNTpublic void mergeTupleIntoGroup(Tuple tup)
mergeTupleIntoGroup
in interface Aggregator
tup
- the Tuple containing an aggregate field and a group-by fieldpublic DbIterator iterator()
iterator
in interface Aggregator
for a possible helper