public class Aggregate extends Operator
| Modifier and Type | Field and Description |
|---|---|
private int |
aField |
private Aggregator |
aggregator |
private DbIterator |
child |
private int |
gbField |
private DbIterator |
iterator |
private Aggregator.Op |
op |
private static long |
serialVersionUID |
private TupleDesc |
tupleDesc |
| Constructor and Description |
|---|
Aggregate(DbIterator child,
int afield,
int gfield,
Aggregator.Op aop)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
aggregateField() |
java.lang.String |
aggregateFieldName() |
Aggregator.Op |
aggregateOp() |
void |
close()
Closes the iterator
|
protected Tuple |
fetchNext()
Returns the next tuple.
|
DbIterator[] |
getChildren() |
TupleDesc |
getTupleDesc()
Returns the TupleDesc of this Aggregate.
|
int |
groupField() |
java.lang.String |
groupFieldName() |
static java.lang.String |
nameOfAggregatorOp(Aggregator.Op aop) |
void |
open()
Opens the iterator
|
void |
rewind()
Rewinds the iterator
|
void |
setChildren(DbIterator[] children)
Set the children(child) of this operator.
|
getEstimatedCardinality, hasNext, next, setEstimatedCardinalityprivate static final long serialVersionUID
private DbIterator child
private DbIterator iterator
private int aField
private int gbField
private Aggregator.Op op
private TupleDesc tupleDesc
private Aggregator aggregator
public Aggregate(DbIterator child, int afield, int gfield, Aggregator.Op aop)
IntegerAggregator or StringAggregator to help
you with your implementation of readNext().child - The DbIterator that is feeding us tuples.afield - The column over which we are computing an aggregate.gfield - The column over which we are grouping the result, or -1 if
there is no groupingaop - The aggregation operator to usepublic int groupField()
Aggregator.NO_GROUPINGpublic java.lang.String groupFieldName()
public int aggregateField()
public java.lang.String aggregateFieldName()
public Aggregator.Op aggregateOp()
public static java.lang.String nameOfAggregatorOp(Aggregator.Op aop)
public void open()
throws java.util.NoSuchElementException,
DbException,
TransactionAbortedException
open in interface DbIteratoropen in class Operatorjava.util.NoSuchElementException - When no element is foundDbExceptionTransactionAbortedExceptionprotected Tuple fetchNext() throws TransactionAbortedException, DbException
fetchNext in class OperatorDbExceptionTransactionAbortedExceptionpublic void rewind()
throws DbException,
TransactionAbortedException
public TupleDesc getTupleDesc()
getTupleDesc in interface DbIteratorgetTupleDesc in class Operatorpublic void close()
close in interface DbIteratorclose in class Operatorpublic DbIterator[] getChildren()
getChildren in class Operatorpublic void setChildren(DbIterator[] children)
OperatorsetChildren in class Operatorchildren - the DbIterators which are to be set as the children(child) of
this operator