|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.btree.view.FusedTupleIterator<I,E>
public class FusedTupleIterator<I extends ITupleIterator<E>,E>
An aggregate iterator view of the one or more source ITupleIterators.
FusedView.rangeIterator(byte[], byte[], int, int, com.bigdata.btree.filter.IFilterConstructor)| Field Summary | |
|---|---|
protected int |
current
Index into sourceIterator and sourceTuple of the iterator whose
tuple will be returned next -or- -1 if we need to choose the
next ITuple to be visited. |
protected boolean |
DEBUG
True iff the log level is DEBUG or less. |
protected boolean |
deleted
True iff IRangeQuery.DELETED semantics will be applied (that is,
true if the caller wants to see the deleted tuples). |
protected int |
flags
The flags specified to the ctor. |
protected boolean |
INFO
True iff the log level is INFO or less. |
protected int |
lastVisited
The index into sourceIterator of the iterator whose tuple was last
returned by next(). |
protected static org.apache.log4j.Logger |
log
|
protected int |
n
The #of source iterators. |
protected I[] |
sourceIterator
The source iterators in the order given to the ctor. |
protected ITuple<E>[] |
sourceTuple
The current ITuple from each source and null if we
need to get another ITuple from that source. |
| Constructor Summary | |
|---|---|
FusedTupleIterator(int flags,
boolean deleted,
I[] sourceIterators)
Create an ITupleIterator reading from an ordered set of source
ITupleIterators. |
|
| Method Summary | |
|---|---|
protected void |
clearCurrent()
Clear tuples from other sources having the same key as the current tuple. |
protected ITuple<E> |
consumeLookaheadTuple()
Consume the current source ITuple. |
boolean |
hasNext()
|
ITuple<E> |
next()
Advance the iterator and return the ITuple from which you can
extract the data and metadata for next entry. |
void |
remove()
Operation is not supported. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger log
protected final boolean INFO
log level is INFO or less.
protected final boolean DEBUG
log level is DEBUG or less.
protected final int flags
protected final boolean deleted
IRangeQuery.DELETED semantics will be applied (that is,
true if the caller wants to see the deleted tuples).
protected final int n
protected final I extends ITupleIterator<E>[] sourceIterator
protected final ITuple<E>[] sourceTuple
ITuple from each source and null if we
need to get another ITuple from that source. The value for a
source iterator that has been exhausted will remain null.
When all entries in this array are null there are no more
ITuples to be visited and we are done.
Note: We process the iterators in the order given. Unless
IRangeQuery.DELETED are being materialized we will only visit the
ITuple for the first iterator having a entry for that key. This
is achieved by setting the elements in this array to null
for any iterator having a ITuple for the same key.
protected int current
sourceIterator and sourceTuple of the iterator whose
tuple will be returned next -or- -1 if we need to choose the
next ITuple to be visited.
protected int lastVisited
sourceIterator of the iterator whose tuple was last
returned by next().
| Constructor Detail |
|---|
public FusedTupleIterator(int flags,
boolean deleted,
I[] sourceIterators)
ITupleIterator reading from an ordered set of source
ITupleIterators. The order of the source iterators is important.
The first matching ITuple for a key will be the ITuple
that gets returned. Other ITuples for the same key will be from
source iterators later in the precedence order will be silently skipped.
flags - The flags specified for the source iterators (it is up to the
caller to make sure that the same flags were used for all
iterators).deleted - false unless you want to see the deleted tuples
in your application.sourceIterators - Each source iterator MUST specify IRangeQuery.DELETED.
This is NOT optional. The IRangeQuery.DELETED is
required for the fused view iterator to recognize a deleted
index entry and discard a historical undeleted entry later in
the predence order for the view.| Method Detail |
|---|
public boolean hasNext()
hasNext in interface Iterator<ITuple<E>>public ITuple<E> next()
ITupleIteratorITuple from which you can
extract the data and metadata for next entry.
Note: An ITupleIterators will generally return the same
ITuple reference on on each invocation of this method. The caller
is responsible for copying out any data or metadata of interest before
calling ITupleIterator.next() again. See TupleFilter which is aware of
this and can be used to stack filters safely.
next in interface ITupleIterator<E>next in interface Iterator<ITuple<E>>ITuple containing the data and metadata for the
current index entry.protected ITuple<E> consumeLookaheadTuple()
current source ITuple.
current tuple.protected void clearCurrent()
Clear tuples from other sources having the same key as the current tuple.
If any source has the same key then we clear it's tuple since we have already returned a tuple for that key. This is necessary in order for the aggregate iterator to skip over additional tuples in other source streams once we identify a source stream having a tuple for a given key.
FusedView then an additional flag could be
introduced to the ctor and this method could be modified to NOT
skip over the tuples whose key is EQ to the current key.public void remove()
Note: Remove is not supported at this level. Instead you must use a
FusedTupleCursor. This is handled automatically by
FusedView.rangeIterator(byte[], byte[], int, int, com.bigdata.btree.filter.IFilterConstructor).
remove in interface Iterator<ITuple<E>>UnsupportedOperationException - always.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||