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, setEstimatedCardinality
private 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()
DbIterator
getTupleDesc
in interface DbIterator
getTupleDesc
in class Operator
public void open() throws DbException, java.util.NoSuchElementException, TransactionAbortedException
open
in interface DbIterator
open
in class Operator
DbException
java.util.NoSuchElementException
TransactionAbortedException
public void close()
close
in interface DbIterator
close
in class Operator
public void rewind() throws DbException, TransactionAbortedException
protected Tuple fetchNext() throws java.util.NoSuchElementException, TransactionAbortedException, DbException
fetchNext
in class Operator
java.util.NoSuchElementException
TransactionAbortedException
DbException
Predicate.filter(simpledb.Tuple)
public DbIterator[] getChildren()
getChildren
in class Operator
public void setChildren(DbIterator[] children)
setChildren
in class Operator
children
- the DbIterators which are to be set as the children(child) of
this operator