Class TemporaryRowHolderImpl
java.lang.Object
org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl
- All Implemented Interfaces:
TemporaryRowHolder
This is a class that is used to temporarily
(non-persistently) hold rows that are used in
language execution. It will store them in an
array, or a temporary conglomerate, depending
on the number of rows.
It is used for deferred DML processing.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) ActivationActivation object with local state information.private ConglomerateControllerprivate longprivate booleanstatic final intprivate RowLocationprivate booleanprivate booleanprotected intprivate intprivate SQLLongintprivate ConglomerateControllerprivate longprivate booleanprivate DataValueDescriptor[]private Propertiesprivate ResultDescriptionprotected ExecRow[]private ScanControllerprotected intprotected static final intprotected static final intprotected static final intprivate ConglomerateControllerprivate longprivate booleanprivate DataValueDescriptor[] -
Constructor Summary
ConstructorsConstructorDescriptionTemporaryRowHolderImpl(Activation activation, Properties properties, ResultDescription resultDescription) Uses the default overflow to a conglomerate threshold (5).TemporaryRowHolderImpl(Activation activation, Properties properties, ResultDescription resultDescription, boolean isUniqueStream) Uses the default overflow to a conglomerate threshold (5).TemporaryRowHolderImpl(Activation activation, Properties properties, ResultDescription resultDescription, int overflowToConglomThreshold, boolean isUniqueStream, boolean isVirtualMemHeap) Create a temporary row holder with the defined overflow to conglom -
Method Summary
Modifier and TypeMethodDescriptionprivate ExecRowvoidclose()Clean uplongGet a result set for scanning what has been inserted so far.longAccessor to get the id of the temporary conglomerate.voidInsert a rowprivate voidinsertToPositionIndex(int position, RowLocation rl) Maintain an index that will allow us to read from the temporary heap in the order we inserted.private booleanisRowAlreadyExist(ExecRow inputRow) Maintain an unique index based on the input row's row location in the base table, this index make sures that we don't insert duplicate rows into the temporary heap.private PropertiesmakeIndexProperties(DataValueDescriptor[] indexRowArray, long conglomId) voidvoidtruncate()Purge the row holder of all its rows.
-
Field Details
-
DEFAULT_OVERFLOWTHRESHOLD
public static final int DEFAULT_OVERFLOWTHRESHOLD- See Also:
-
STATE_UNINIT
protected static final int STATE_UNINIT- See Also:
-
STATE_INSERT
protected static final int STATE_INSERT- See Also:
-
STATE_DRAIN
protected static final int STATE_DRAIN- See Also:
-
rowArray
-
lastArraySlot
protected int lastArraySlot -
numRowsIn
private int numRowsIn -
state
protected int state -
CID
private long CID -
conglomCreated
private boolean conglomCreated -
cc
-
properties
-
scan
-
resultDescription
-
activation
Activation activationActivation object with local state information. -
isUniqueStream
private boolean isUniqueStream -
isVirtualMemHeap
private boolean isVirtualMemHeap -
uniqueIndexCreated
private boolean uniqueIndexCreated -
positionIndexCreated
private boolean positionIndexCreated -
uniqueIndexConglomId
private long uniqueIndexConglomId -
positionIndexConglomId
private long positionIndexConglomId -
uniqueIndex_cc
-
positionIndex_cc
-
uniqueIndexRow
-
positionIndexRow
-
destRowLocation
-
position_sqllong
-
-
Constructor Details
-
TemporaryRowHolderImpl
public TemporaryRowHolderImpl(Activation activation, Properties properties, ResultDescription resultDescription) Uses the default overflow to a conglomerate threshold (5).- Parameters:
activation- the activationproperties- the properties of the original table. Used to help the store use optimal page size, etc.resultDescription- the result description. Relevant for the getResultDescription call on the result set returned by getResultSet. May be null
-
TemporaryRowHolderImpl
public TemporaryRowHolderImpl(Activation activation, Properties properties, ResultDescription resultDescription, boolean isUniqueStream) Uses the default overflow to a conglomerate threshold (5).- Parameters:
activation- the activationproperties- the properties of the original table. Used to help the store use optimal page size, etc.resultDescription- the result description. Relevant for the getResultDescription call on the result set returned by getResultSet. May be nullisUniqueStream- - true , if it has to be temporary row holder unique stream
-
TemporaryRowHolderImpl
public TemporaryRowHolderImpl(Activation activation, Properties properties, ResultDescription resultDescription, int overflowToConglomThreshold, boolean isUniqueStream, boolean isVirtualMemHeap) Create a temporary row holder with the defined overflow to conglom- Parameters:
activation- the activationproperties- the properties of the original table. Used to help the store use optimal page size, etc.resultDescription- the result description. Relevant for the getResultDescription call on the result set returned by getResultSet. May be nulloverflowToConglomThreshold- on an attempt to insert this number of rows, the rows will be put into a temporary conglomerate.
-
-
Method Details
-
cloneRow
-
insert
Insert a row- Specified by:
insertin interfaceTemporaryRowHolder- Parameters:
inputRow- the row to insert- Throws:
StandardException- on error
-
isRowAlreadyExist
Maintain an unique index based on the input row's row location in the base table, this index make sures that we don't insert duplicate rows into the temporary heap.- Parameters:
inputRow- the row we are inserting to temporary row holder- Throws:
StandardException- on error
-
insertToPositionIndex
Maintain an index that will allow us to read from the temporary heap in the order we inserted.- Parameters:
position- - the number of the row we are inserting into heaprl- the row to Location in the temporary heap- Throws:
StandardException- on error
-
getResultSet
Get a result set for scanning what has been inserted so far.- Specified by:
getResultSetin interfaceTemporaryRowHolder- Returns:
- a result set to use
-
truncate
Purge the row holder of all its rows. Resets the row holder so that it can accept new inserts. A cheap way to recycle a row holder.- Throws:
StandardException- on error
-
getTemporaryConglomId
public long getTemporaryConglomId()Accessor to get the id of the temporary conglomerate. Temporary conglomerates have negative ids. An id equal to zero means that no temporary conglomerate has been created.- Specified by:
getTemporaryConglomIdin interfaceTemporaryRowHolder- Returns:
- Conglomerate ID of temporary conglomerate
-
getPositionIndexConglomId
public long getPositionIndexConglomId()- Specified by:
getPositionIndexConglomIdin interfaceTemporaryRowHolder
-
makeIndexProperties
private Properties makeIndexProperties(DataValueDescriptor[] indexRowArray, long conglomId) throws StandardException - Throws:
StandardException
-
setRowHolderTypeToUniqueStream
public void setRowHolderTypeToUniqueStream()- Specified by:
setRowHolderTypeToUniqueStreamin interfaceTemporaryRowHolder
-
close
Clean up- Specified by:
closein interfaceTemporaryRowHolder- Throws:
StandardException- on error
-