public class FusedTupleIterator<I extends ITupleIterator<E>,E> extends Object implements ITupleIterator<E>
An aggregate iterator view of the one or more source ITupleIterator
s.
FusedView#rangeIterator(byte[], byte[], int, int, com.bigdata.btree.filter.IFilterConstructor)
Modifier and Type | Field and Description |
---|---|
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
|
Constructor and Description |
---|
FusedTupleIterator(int flags,
boolean deleted,
I[] sourceIterators)
Create an
ITupleIterator reading from an ordered set of source
ITupleIterator s. |
Modifier and Type | Method and Description |
---|---|
protected void |
clearCurrent()
Clear tuples from other sources having the same key as the current tuple.
|
protected ITuple<E> |
consumeLookaheadTuple()
|
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.
|
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
ITuple
s 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()
.public FusedTupleIterator(int flags, boolean deleted, I[] sourceIterators)
ITupleIterator
reading from an ordered set of source
ITupleIterator
s. The order of the source iterators is important.
The first matching ITuple
for a key will be the ITuple
that gets returned. Other ITuple
s 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.public ITuple<E> next()
ITupleIterator
ITuple
from which you can
extract the data and metadata for next entry.
Note: An ITupleIterator
s 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.
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.
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.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.