public class OrderBy extends Operator
Modifier and Type | Field and Description |
---|---|
private boolean |
asc |
private DbIterator |
child |
private java.util.ArrayList<Tuple> |
childTups |
private java.util.Iterator<Tuple> |
it |
private int |
orderByField |
private java.lang.String |
orderByFieldName |
private static long |
serialVersionUID |
private TupleDesc |
td |
Constructor and Description |
---|
OrderBy(int orderbyField,
boolean asc,
DbIterator child)
Creates a new OrderBy node over the tuples from the iterator.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this iterator.
|
protected Tuple |
fetchNext()
Operator.fetchNext implementation.
|
DbIterator[] |
getChildren() |
int |
getOrderByField() |
java.lang.String |
getOrderFieldName() |
TupleDesc |
getTupleDesc()
Returns the TupleDesc associated with this DbIterator.
|
boolean |
isASC() |
void |
open()
Opens the iterator.
|
void |
rewind()
Resets the iterator to the start.
|
void |
setChildren(DbIterator[] children)
Set the children(child) of this operator.
|
getEstimatedCardinality, hasNext, next, setEstimatedCardinality
private static final long serialVersionUID
private DbIterator child
private TupleDesc td
private java.util.ArrayList<Tuple> childTups
private int orderByField
private java.lang.String orderByFieldName
private java.util.Iterator<Tuple> it
private boolean asc
public OrderBy(int orderbyField, boolean asc, DbIterator child)
orderbyField
- the field to which the sort is applied.asc
- true if the sort order is ascending.child
- the tuples to sort.public boolean isASC()
public int getOrderByField()
public java.lang.String getOrderFieldName()
public TupleDesc getTupleDesc()
DbIterator
getTupleDesc
in interface DbIterator
getTupleDesc
in class Operator
public void open() throws DbException, java.util.NoSuchElementException, TransactionAbortedException
DbIterator
open
in interface DbIterator
open
in class Operator
DbException
- when there are problems opening/accessing the database.java.util.NoSuchElementException
TransactionAbortedException
public void close()
Operator
close
in interface DbIterator
close
in class Operator
public void rewind() throws DbException, TransactionAbortedException
DbIterator
DbException
- when rewind is unsupported.TransactionAbortedException
protected Tuple fetchNext() throws java.util.NoSuchElementException, TransactionAbortedException, DbException
fetchNext
in class Operator
java.util.NoSuchElementException
TransactionAbortedException
DbException
public DbIterator[] getChildren()
getChildren
in class Operator
public void setChildren(DbIterator[] children)
Operator
setChildren
in class Operator
children
- the DbIterators which are to be set as the children(child) of
this operator