Package org.teiid.common.buffer
Class TupleBuffer
- java.lang.Object
-
- org.teiid.common.buffer.TupleBuffer
-
public class TupleBuffer extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
TupleBuffer.TupleBufferTupleSource
-
Constructor Summary
Constructors Constructor Description TupleBuffer(BatchManager manager, String id, List<? extends Expression> schema, LobManager lobManager, int batchSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTuple(List<?> tuple)
void
addTupleBatch(TupleBatch batch, boolean save)
Adds the given batch preserving row offsets.void
close()
TupleBuffer.TupleBufferTupleSource
createIndexedTupleSource()
TupleBuffer.TupleBufferTupleSource
createIndexedTupleSource(boolean singleUse)
Create a new iterator for this bufferTupleBatch
getBatch(long row)
Get the batch containing the given row.int
getBatchSize()
String
getId()
int
getLobCount()
Streamable<?>
getLobReference(String id)
long
getManagedRowCount()
Returns the total number of rows contained in managed batcheslong
getRowCount()
Returns the last row numberint
getRowSizeEstimate()
Return a more accurate batch estimate or 0 if a new estimate is not availableList<? extends Expression>
getSchema()
static String[]
getTypeNames(List<? extends Expression> expressions)
Gets the data type names for each of the input expressions, in order.String[]
getTypes()
boolean
isFinal()
boolean
isForwardOnly()
boolean
isLobs()
boolean
isRemoved()
void
persistLobs()
void
purge()
void
remove()
void
removeLobTracking()
void
saveBatch()
Force the persistence of any rows held in memory.void
setBatchSize(int batchSize)
void
setFinal(boolean isFinal)
void
setForwardOnly(boolean forwardOnly)
void
setId(String uuid)
void
setInlineLobs(boolean inline)
void
setPrefersMemory(boolean prefersMemory)
void
setRowCount(long rowCount)
String
toString()
void
truncateTo(int rowLimit)
-
-
-
Constructor Detail
-
TupleBuffer
public TupleBuffer(BatchManager manager, String id, List<? extends Expression> schema, LobManager lobManager, int batchSize)
-
-
Method Detail
-
getTypeNames
public static String[] getTypeNames(List<? extends Expression> expressions)
Gets the data type names for each of the input expressions, in order.- Parameters:
expressions
- List of Expressions- Returns:
- Since:
- 4.2
-
setInlineLobs
public void setInlineLobs(boolean inline)
-
removeLobTracking
public void removeLobTracking()
-
getId
public String getId()
-
setId
public void setId(String uuid)
-
isLobs
public boolean isLobs()
-
addTuple
public void addTuple(List<?> tuple) throws TeiidComponentException
- Throws:
TeiidComponentException
-
addTupleBatch
public void addTupleBatch(TupleBatch batch, boolean save) throws TeiidComponentException
Adds the given batch preserving row offsets.- Parameters:
batch
-- Throws:
TeiidComponentException
-
setRowCount
public void setRowCount(long rowCount) throws TeiidComponentException
- Throws:
TeiidComponentException
-
purge
public void purge()
-
persistLobs
public void persistLobs() throws TeiidComponentException
- Throws:
TeiidComponentException
-
saveBatch
public void saveBatch() throws TeiidComponentException
Force the persistence of any rows held in memory.- Throws:
TeiidComponentException
-
close
public void close() throws TeiidComponentException
- Throws:
TeiidComponentException
-
getBatch
public TupleBatch getBatch(long row) throws TeiidComponentException
Get the batch containing the given row. NOTE: the returned batch may be empty or may begin with a row other than the one specified.- Parameters:
row
-- Returns:
- Throws:
TeiidComponentException
- TODO: a method to get the raw batch
-
remove
public void remove()
-
getManagedRowCount
public long getManagedRowCount()
Returns the total number of rows contained in managed batches- Returns:
-
getRowCount
public long getRowCount()
Returns the last row number- Returns:
-
isFinal
public boolean isFinal()
-
setFinal
public void setFinal(boolean isFinal)
-
getSchema
public List<? extends Expression> getSchema()
-
getBatchSize
public int getBatchSize()
-
setBatchSize
public void setBatchSize(int batchSize)
-
getLobReference
public Streamable<?> getLobReference(String id) throws TeiidComponentException
- Throws:
TeiidComponentException
-
setForwardOnly
public void setForwardOnly(boolean forwardOnly)
-
createIndexedTupleSource
public TupleBuffer.TupleBufferTupleSource createIndexedTupleSource()
-
createIndexedTupleSource
public TupleBuffer.TupleBufferTupleSource createIndexedTupleSource(boolean singleUse)
Create a new iterator for this buffer- Returns:
-
isRemoved
public boolean isRemoved()
-
isForwardOnly
public boolean isForwardOnly()
-
setPrefersMemory
public void setPrefersMemory(boolean prefersMemory)
-
getTypes
public String[] getTypes()
-
getLobCount
public int getLobCount()
-
truncateTo
public void truncateTo(int rowLimit) throws TeiidComponentException
- Throws:
TeiidComponentException
-
getRowSizeEstimate
public int getRowSizeEstimate()
Return a more accurate batch estimate or 0 if a new estimate is not available
-
-