Package org.teiid.query.processor
Class BatchIterator
- java.lang.Object
-
- org.teiid.common.buffer.AbstractTupleSource
-
- org.teiid.query.processor.BatchIterator
-
- All Implemented Interfaces:
IndexedTupleSource
,TupleSource
public class BatchIterator extends AbstractTupleSource
A BatchIterator provides an iterator interface to aBatchCollector.BatchProducer
. By settingsetBuffer(TupleBuffer, boolean)
, the iterator can copy on read into aTupleBuffer
for repeated reading. Note that the saveOnMark buffering only lasts until the next mark is set.
-
-
Field Summary
-
Fields inherited from class org.teiid.common.buffer.AbstractTupleSource
batch, currentTuple
-
-
Constructor Summary
Constructors Constructor Description BatchIterator(BatchCollector.BatchProducer source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
available()
void
closeSource()
Closes the Tuple Source.void
disableSave()
boolean
ensureSave()
non-destructive method to set the markprotected List<?>
finalRow()
protected TupleBatch
getBatch(long row)
TupleBuffer
getBuffer()
protected List<?>
getCurrentTuple()
void
mark()
Save the current position that can be restored with a call toIndexedTupleSource.reset()
void
readAhead(long limit)
void
reset()
Restore the previous mark and set the mark back to the first position.void
setBuffer(TupleBuffer buffer, boolean saveOnMark)
void
setPosition(long position)
Set the tuple source position-
Methods inherited from class org.teiid.common.buffer.AbstractTupleSource
getCurrentIndex, hasNext, nextTuple
-
-
-
-
Constructor Detail
-
BatchIterator
public BatchIterator(BatchCollector.BatchProducer source)
-
-
Method Detail
-
getBatch
protected TupleBatch getBatch(long row) throws TeiidComponentException, TeiidProcessingException
- Specified by:
getBatch
in classAbstractTupleSource
- Throws:
TeiidComponentException
TeiidProcessingException
-
finalRow
protected List<?> finalRow() throws TeiidComponentException, TeiidProcessingException
- Specified by:
finalRow
in classAbstractTupleSource
- Throws:
TeiidComponentException
TeiidProcessingException
-
getCurrentTuple
protected List<?> getCurrentTuple() throws TeiidComponentException, BlockedException, TeiidProcessingException
- Overrides:
getCurrentTuple
in classAbstractTupleSource
- Throws:
TeiidComponentException
BlockedException
TeiidProcessingException
-
available
public long available()
- Specified by:
available
in classAbstractTupleSource
-
setBuffer
public void setBuffer(TupleBuffer buffer, boolean saveOnMark)
-
closeSource
public void closeSource()
Description copied from interface:TupleSource
Closes the Tuple Source.- Specified by:
closeSource
in interfaceTupleSource
- Overrides:
closeSource
in classAbstractTupleSource
-
reset
public void reset()
Description copied from interface:IndexedTupleSource
Restore the previous mark and set the mark back to the first position.- Specified by:
reset
in interfaceIndexedTupleSource
- Overrides:
reset
in classAbstractTupleSource
-
mark
public void mark() throws TeiidComponentException
Description copied from interface:IndexedTupleSource
Save the current position that can be restored with a call toIndexedTupleSource.reset()
- Specified by:
mark
in interfaceIndexedTupleSource
- Overrides:
mark
in classAbstractTupleSource
- Throws:
TeiidComponentException
-
setPosition
public void setPosition(long position)
Description copied from interface:IndexedTupleSource
Set the tuple source position- Specified by:
setPosition
in interfaceIndexedTupleSource
- Overrides:
setPosition
in classAbstractTupleSource
-
ensureSave
public boolean ensureSave()
non-destructive method to set the mark- Returns:
- true if the mark was set
-
disableSave
public void disableSave()
-
readAhead
public void readAhead(long limit) throws TeiidComponentException, TeiidProcessingException
-
getBuffer
public TupleBuffer getBuffer()
-
-