public class Filter extends Operator
| Modifier and Type | Field and Description |
|---|---|
private DbIterator |
iterator |
private Predicate |
predicate |
private static long |
serialVersionUID |
| Constructor and Description |
|---|
Filter(Predicate p,
DbIterator child)
Constructor accepts a predicate to apply and a child operator to read
tuples to filter from.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the iterator
|
protected Tuple |
fetchNext()
AbstractDbIterator.readNext implementation.
|
DbIterator[] |
getChildren() |
Predicate |
getPredicate() |
TupleDesc |
getTupleDesc()
Returns the TupleDesc associated with this DbIterator.
|
void |
open()
Opens the iterator for scanning
|
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 Predicate predicate
private DbIterator iterator
public Filter(Predicate p, DbIterator child)
p - The predicate to filter tuples withchild - The child operatorpublic Predicate getPredicate()
public TupleDesc getTupleDesc()
DbIteratorgetTupleDesc in interface DbIteratorgetTupleDesc in class Operatorpublic void open()
throws DbException,
java.util.NoSuchElementException,
TransactionAbortedException
open in interface DbIteratoropen in class OperatorDbExceptionjava.util.NoSuchElementExceptionTransactionAbortedExceptionpublic void close()
close in interface DbIteratorclose in class Operatorpublic void rewind()
throws DbException,
TransactionAbortedException
protected Tuple fetchNext() throws java.util.NoSuchElementException, TransactionAbortedException, DbException
fetchNext in class Operatorjava.util.NoSuchElementExceptionTransactionAbortedExceptionDbExceptionPredicate.filter(simpledb.Tuple)public DbIterator[] getChildren()
getChildren in class Operatorpublic void setChildren(DbIterator[] children)
setChildren in class Operatorchildren - the DbIterators which are to be set as the children(child) of
this operator