Interface IChunk<K>
-
- Type Parameters:
K- the type of data stored by the chunk
- All Superinterfaces:
IArray,IArrayReader,IArrayWriter,IMemoryMonitored,IWritableArray
- All Known Subinterfaces:
ICanCollectVectors<K>,IChunkBoolean,IChunkComposite,IChunkDouble,IChunkFloat,IChunkInteger,IChunkLong,IChunkNullable<K>,IChunkPositiveInteger,IChunkPrimitiveInteger,IChunkSingleValue<K>,IConcurrentChunkInteger,IConcurrentChunkLong,IDecoratedChunk<D,V>,IFrequentValueChunk<K>,IVectorChunk
- All Known Implementing Classes:
AChunk,AChunkOffset,AChunkPositiveInteger,AChunkPrimitiveInteger,ADirectChunk,ADirectChunkNullable,ADirectChunkPrimitiveInteger,ADirectVectorBlock,ArrayChunkBits,ArrayChunkBoolean,ArrayChunkBytes,ArrayChunkDouble,ArrayChunkDoubleNullable,ArrayChunkFloat,ArrayChunkFloatNullable,ArrayChunkHexa,ArrayChunkInteger,ArrayChunkIntegerNullable,ArrayChunkLong,ArrayChunkLongNullable,ArrayChunkPositiveInteger,ArrayChunkQuad,ArrayChunkShorts,ArrayChunkTriBytes,BufferChunkBoolean,BufferChunkDouble,BufferChunkDoubleNullable,BufferChunkFloat,BufferChunkFloatNullable,BufferChunkLong,BufferChunkLongNullable,BufferChunkPositiveInteger,BufferChunkPrimitiveBits,BufferChunkPrimitiveBytes,BufferChunkPrimitiveHexa,BufferChunkPrimitiveInts,BufferChunkPrimitiveIntsNullable,BufferChunkPrimitiveQuad,BufferChunkPrimitiveShorts,BufferChunkPrimitiveTriBytes,ChunkComposite,ChunkCompositeSparse,ChunkDictionary,ChunkHistory,ChunkHistory.SparseChunkHistory,ChunkMarked,ChunkMarkedVector,ChunkObject,ChunkOffsetInteger,ChunkOffsetLong,ChunkSingleBoolean,ChunkSingleDouble,ChunkSingleFloat,ChunkSingleInteger,ChunkSingleLong,ChunkSingleObject,ChunkSingleTimestamp,ChunkSingleVector,ChunkVector,DirectChunkBits,DirectChunkBoolean,DirectChunkBytes,DirectChunkDouble,DirectChunkDoubleNullable,DirectChunkFloat,DirectChunkFloatNullable,DirectChunkHexa,DirectChunkInteger,DirectChunkIntegerNullable,DirectChunkLong,DirectChunkLongNullable,DirectChunkPositiveInteger,DirectChunkQuad,DirectChunkShorts,DirectChunkTriBytes,DirectDoubleVectorBlock,DirectFloatVectorBlock,DirectIntegerVectorBlock,DirectLongVectorBlock,EmptyChunk,FrequentDoubleChunk,FrequentFloatChunk,FrequentIntegerChunk,FrequentLongChunk,FrequentNullDoubleChunk,FrequentNullFloatChunk,FrequentNullIntegerChunk,FrequentNullLongChunk,FrequentObjectChunk,NullableFrequentDoubleChunk,NullableFrequentFloatChunk,NullableFrequentIntegerChunk,NullableFrequentLongChunk,SparseChunk,TombStoneChunk,WrapperChunkInteger
public interface IChunk<K> extends IWritableArray
A chunk of data within a column. The column delegates read and write operations to its chunks.Various implementations of the chunk interface can handle various kinds of data, including space efficient primitives.
The implementation of a chunk must allow multiple concurrent readers to read the data while one single writer writes in the chunk. Multiple concurrent writers is not by default supported by chunk implementations.
- Author:
- ActiveViam
-
-
Field Summary
Fields Modifier and Type Field Description static intNO_SIZE_LIMITSpecial value to pass as a limit not to set a limit when scanning values in a chunk.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description intcapacity()Returns the (fixed) capacity of the chunk (number of elements it can store).IChunk<K>compress(IRowMapping mapping, int[] arrayMapping, int newChunkSize, IChunkFactory<K> defaultChunkCreator)Creates a compressed chunk from this chunk, using only the rows given in the mapping.voidcopyInto(int position, IWritableCell cell)Copies the value at a given position in this chunk into the provided cell.default IArrayCursorcreateArrayCursor()Creates a new read-only cursor that can be moved up and down the array.default IFrequentValueChunk<K>createFrequentValueChunk(int chunkSize, K frequentValue, IChunk<K> underlyingChunk, IRowMapping mapping, boolean hasNullValues)Creates a compressed version of this chunk using frequency compression.Runnabledestroy()Equivalent to a finalizer for this chunk, but that can be called by the application when it is certain that the chunk will not be used or even reached anymore.voidfindRowsEqualTo(Object value, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with the sought object in the chunk.voidfindRowsEqualTo(Object value, long epoch, IChunkLong version, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with the sought object in the chunk.voidfindRowsEqualTo(Object value, IIntIterator filter, int offset, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with the sought object in the chunk.voidfindRowsInSet(Set<Object> values, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.voidfindRowsInSet(Set<Object> values, long epoch, IChunkLong version, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.voidfindRowsInSet(Set<Object> values, IIntIterator filter, int offset, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.voidfindRowsInTransactionEqualTo(Object value, IIntIterator filter, IBitmap deletions, int offset, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with the sought object in the chunk.voidfindRowsInTransactionEqualTo(Object value, IChunkLong version, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with the sought object in the chunk.voidfindRowsInTransactionEqualTo(Object value, IChunkLong version, IBitmap deletions, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with the sought object in the chunk.voidfindRowsInTransactionInSet(Set<Object> values, IIntIterator filter, IBitmap deletions, int offset, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.voidfindRowsInTransactionInSet(Set<Object> values, IChunkLong version, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.voidfindRowsInTransactionInSet(Set<Object> values, IChunkLong version, IBitmap deletions, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.default voidfreeRow(int row)Clears the data stored at a given row.intgetBindingType()Gets the type for binding transfers of this chunk.default IChunkFactory<K>getChunkCreatorForSparse(IChunkFactory<K> defaultChunkCreator)Gets the chunk creator to use for the internal smaller chunk when replacing this chunk with a sparse chunk.longgetChunkId()Gets the unique ID of this chunk.default StringgetChunkType()(For debug purpose) Gets the type of the chunk, and, if this chunk has an underlying chunk, the type of its underlying chunks recursively.default intgetPhysicalSize(IRowMapping mapping)Returns the physical size of chunk before the chunk was compressed, if the chunk have not been compressed, it returns the chunk capacity.booleanisDead()Whether this chunk is dead.booleanisPrimitive()Returns whether this chunk contains primitive data, as perTypes.isPrimitive(int).default intlocalRow(int chunkRow, IRowMapping mapping)Converts the corresponding chunk row into the underlying chunk, if it is aSparseChunk, otherwise it returns the chunk row.Kread(int position)Returns the data stored at that position in the chunk.default RunnablereplaceBy(IChunk<?> replacement)Returns the destructor to run when this chunk is replaced by the given chunk.voidreset()Resets the chunk before it is reused.default IChunk<K>sparseChunkCompression(IRowMapping mapping, int[] arrayMapping, int newChunkSize, IChunkFactory<K> underlyingChunkCreator)Creates a sparse chunk from this chunk.voidtransfer(IWritableTable destination, int destinationColumn, int[] rowsMapping, int numRows)Transfers a given number of rows from this chunk to target rows in the given column of the destinationtable.voidwriteFromCell(int position, IReadableCell cell)Writes the content of the cell into the chunk at the given position.-
Methods inherited from interface com.qfs.chunk.IArrayReader
isNull, readBoolean, readDouble, readFloat, readInt, readLong, readVector
-
Methods inherited from interface com.qfs.chunk.IArrayWriter
addDouble, addFloat, addInt, addLong, write, writeBoolean, writeDouble, writeFloat, writeInt, writeLong
-
Methods inherited from interface com.qfs.monitoring.memory.IMemoryMonitored
getMemoryStatistic
-
-
-
-
Field Detail
-
NO_SIZE_LIMIT
static final int NO_SIZE_LIMIT
Special value to pass as a limit not to set a limit when scanning values in a chunk.- See Also:
- Constant Field Values
-
-
Method Detail
-
getChunkId
long getChunkId()
Gets the unique ID of this chunk.- Returns:
- the unique ID of this chunk
-
capacity
int capacity()
Returns the (fixed) capacity of the chunk (number of elements it can store).- Returns:
- the (fixed) capacity of the chunk
-
getBindingType
int getBindingType()
Gets the type for binding transfers of this chunk.- Returns:
- the physical type like
Types.PHYSICAL_INT, etc
-
read
K read(int position)
Returns the data stored at that position in the chunk.- Specified by:
readin interfaceIArrayReader- Parameters:
position- the position in the chunk at which to read- Returns:
- the data stored at that position in the chunk
-
copyInto
void copyInto(int position, IWritableCell cell)Copies the value at a given position in this chunk into the provided cell.- Parameters:
position- row of the chunk to read
-
writeFromCell
void writeFromCell(int position, IReadableCell cell)Writes the content of the cell into the chunk at the given position.It is up to chunks to use the appropriate read method to avoid boxing as much as possible.
-
transfer
void transfer(IWritableTable destination, int destinationColumn, int[] rowsMapping, int numRows)
Transfers a given number of rows from this chunk to target rows in the given column of the destinationtable.The mapping from the source rows to the target rows is described with an array of
2*nslots. Each even slot contains the index of the row to be copied from the source chunk and the following odd slot contains the index of the row into which the source data will be transferred.- Parameters:
destination- the destination tabledestinationColumn- the column to transfer the data to in the destination tablerowsMapping- the mapping from source rows to target rows, as explained abovenumRows- the number of rows to transfer
-
reset
void reset()
Resets the chunk before it is reused.Warning
Chunks holding references to objects will be nullified to avoid getting in the way of the garbage collector, but chunks holding primitive data will be left untouched. Users cannot expect values to be "zeroed" by calling reset.
-
destroy
Runnable destroy()
Equivalent to a finalizer for this chunk, but that can be called by the application when it is certain that the chunk will not be used or even reached anymore.Chunk implementations can use this opportunity to dereference objects, or even free memory in the case of direct memory chunks. For that reason it is unsafe to call destroy() and it is possible to crash the JVM if the chunk is accessed after its memory has been reclaimed.
Most often this
Runnableis registered toIActiveCollector.register(Runnable)to make sure that the destruction is safe.- Returns:
- the
Runnableto run to actually free the data
-
isPrimitive
boolean isPrimitive()
Returns whether this chunk contains primitive data, as perTypes.isPrimitive(int).- Returns:
trueif this chunk contains primitive data, as perTypes.isPrimitive(int),falseotherwise
-
isDead
boolean isDead()
Whether this chunk is dead.For a chunk, being "dead" means to have all its elements removed. Datastore being an "append-only" structure, the data storage of dead chunks may be safely freed immediately after the removal of the last row. But for the same reason dead chunks are still kept inside record sets and their metadata is kept available. For example, dead chunks should still keep track of their capacity, even though they hold no real data.
The dead chunks mostly appear as a result of the following 3 operations:
- Data compression
- Manual
IEpochHistory#forceDiscardEpochs(Predicate)applied to the datastore history - Structural transactions that modify record set content
Every method scanning the chunks is expected to perform the required checks to properly skip the dead chunks. Such methods should not throw when the dead chunk is encountered.
- Returns:
trueif this chunk is dead,falseotherwise
-
findRowsEqualTo
void findRowsEqualTo(Object value, long epoch, IChunkLong version, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with the sought object in the chunk.- Parameters:
value- the sought objectepoch- the epoch will define which rows are read. Only rows created before or deleted after this epoch will be readversion- the column holding the version number at which each row has been inserted or removedoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkchunkLimit- the number of rows to iterate in this chunk, it should not be bigger than the chunk sizemapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with the sought object
-
findRowsEqualTo
void findRowsEqualTo(Object value, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with the sought object in the chunk.- Parameters:
value- the sought objectoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkchunkLimit- the number of rows to iterate in this chunk, it should not be bigger than the chunk sizemapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with the sought object
-
findRowsEqualTo
void findRowsEqualTo(Object value, IIntIterator filter, int offset, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with the sought object in the chunk.- Parameters:
value- the sought objectfilter- all the row numbers that should be considered for this researchoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkmapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with the sought object
-
findRowsInSet
void findRowsInSet(Set<Object> values, long epoch, IChunkLong version, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.- Parameters:
values- the set of sought objectsepoch- the epoch will define which rows are read, only rows created before or deleted after this epoch will be readversion- the column holding the version number at which each row has been inserted or removedoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkchunkLimit- the number of rows to iterate in this chunk, it should not be bigger than the chunk sizemapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with any object in the set of sought objects
-
findRowsInSet
void findRowsInSet(Set<Object> values, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.- Parameters:
values- the set of sought objectsoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkchunkLimit- the number of rows to iterate in this chunk, it should not be bigger than the chunk sizemapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with any object in the set of sought objects
-
findRowsInSet
void findRowsInSet(Set<Object> values, IIntIterator filter, int offset, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.- Parameters:
values- the set of sought objectsfilter- all the row numbers that should be considered for this researchoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkmapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with any object in the set of sought objects
-
findRowsInTransactionEqualTo
void findRowsInTransactionEqualTo(Object value, IChunkLong version, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with the sought object in the chunk.- Parameters:
value- the sought objectversion- the column holding the version number at which each row has been inserted or removed corresponding to this chunkoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkchunkLimit- the number of rows to iterate in this chunk, it should not be bigger than the chunk sizemapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with the sought object
-
findRowsInTransactionEqualTo
void findRowsInTransactionEqualTo(Object value, IChunkLong version, IBitmap deletions, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with the sought object in the chunk.- Parameters:
value- the sought objectversion- the column holding the version number at which each row has been inserted or removed corresponding to this chunkdeletions- a bitmap of deleted rows, that should not be scannedoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkchunkLimit- the number of rows to iterate in this chunk, it should not be bigger than the chunk sizemapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with the sought object
-
findRowsInTransactionEqualTo
void findRowsInTransactionEqualTo(Object value, IIntIterator filter, IBitmap deletions, int offset, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with the sought object in the chunk.- Parameters:
value- the sought objectfilter- all the row numbers that should be considered for this researchdeletions- a bitmap of deleted rows, that should not be scannedoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkmapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with the sought object
-
findRowsInTransactionInSet
void findRowsInTransactionInSet(Set<Object> values, IChunkLong version, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.- Parameters:
values- the set of sought objectsversion- the column holding the version number at which each row has been inserted or removed corresponding to this chunkoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkchunkLimit- the number of rows to iterate in this chunk, it should not be bigger than the chunk sizemapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with any object in the set of sought objects
-
findRowsInTransactionInSet
void findRowsInTransactionInSet(Set<Object> values, IChunkLong version, IBitmap deletions, int offset, int chunkLimit, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.- Parameters:
values- the set of sought objectsversion- the column holding the version number at which each row has been inserted or removed corresponding to this chunkdeletions- a bitmap of deleted rows, that should not be scannedoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkchunkLimit- the number of rows to iterate in this chunk, it should not be bigger than the chunk sizemapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with any object in the set of sought objects
-
findRowsInTransactionInSet
void findRowsInTransactionInSet(Set<Object> values, IIntIterator filter, IBitmap deletions, int offset, IRowMapping mapping, int limit, IBitmap result)
Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.- Parameters:
values- the set of sought objectsfilter- all the row numbers that should be considered for this researchdeletions- a bitmap of deleted rows, that should not be scannedoffset- the offset in the result, the offset is the row number in the store corresponding to the first row in this chunkmapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnulllimit- the size limit for the result of this search, it can be0for a non limit size resultresult- abitmapto add the row numbers matching with any object in the set of sought objects
-
replaceBy
default Runnable replaceBy(IChunk<?> replacement)
Returns the destructor to run when this chunk is replaced by the given chunk.- Parameters:
replacement- the new chunk, that replaces this chunks- Returns:
- the destructor to run when this chunk is replaced by the given chunk
-
localRow
default int localRow(int chunkRow, IRowMapping mapping)Converts the corresponding chunk row into the underlying chunk, if it is aSparseChunk, otherwise it returns the chunk row.- Parameters:
chunkRow- the chunk rowmapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnull- Returns:
- the corresponding row in the chunk
-
getPhysicalSize
default int getPhysicalSize(IRowMapping mapping)
Returns the physical size of chunk before the chunk was compressed, if the chunk have not been compressed, it returns the chunk capacity.- Parameters:
mapping- this mapping is only used when this chunk is aSparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise isnull- Returns:
- the physical size of the chunk
-
freeRow
default void freeRow(int row)
Clears the data stored at a given row.- Parameters:
row- the row
-
compress
IChunk<K> compress(IRowMapping mapping, int[] arrayMapping, int newChunkSize, IChunkFactory<K> defaultChunkCreator)
Creates a compressed chunk from this chunk, using only the rows given in the mapping. The mapping is given in different representations :- The mapping as an
IRowMappingfrom the rows of the externally visible chunk to those of the compressed chunk. This representation corresponds to the mapping used inSparseChunk - The arrayMapping as an array of
2*nslots. This representation corresponds to the mapping used inIChunkBinding.transfer(int[], int). Each even slot contains the index of the row to be copied from this chunk and the following odd slot contains the index of the row into which the data will be in the compressed chunk.
Note that the two representations of the mapping can seem inconsistent, in case we are recompressing the underlying chunk of a sparse chunk (the
IRowMappingmaps the externally visible rows to the rows of the future underlying of the future re-compressed chunk, while the arrayMapping maps the rows of current underlying chunk to the future underlying of re-compressed chunk).- Parameters:
mapping- the mapping from the rows of the externally visible chunk to those of the compressed chunkarrayMapping- the array representation of the mappingnewChunkSize- the size of the chunk we want to createdefaultChunkCreator- the chunk creator for a "normal" chunk (if this chunks knows of a better way to sparse itself, it can use it)- Returns:
- a compressed chunk containing the copied data from this chunk
- The mapping as an
-
createArrayCursor
default IArrayCursor createArrayCursor()
Description copied from interface:IArrayCreates a new read-only cursor that can be moved up and down the array. This cursor delegates all reading calls to the underlying array.- Specified by:
createArrayCursorin interfaceIArray- Specified by:
createArrayCursorin interfaceIWritableArray- Returns:
- the cursor, stationed at index 0 of the array
-
sparseChunkCompression
default IChunk<K> sparseChunkCompression(IRowMapping mapping, int[] arrayMapping, int newChunkSize, IChunkFactory<K> underlyingChunkCreator)
Creates a sparse chunk from this chunk.- Parameters:
mapping- the mapping from the rows of the externally visible chunk to those of the compressed chunkarrayMapping- the array representation of the mappingnewChunkSize- the size of the chunk we want to createunderlyingChunkCreator- the chunk creator for the underlying chunk of the sparse chunk- Returns:
- a compressed chunk containing the copied data from this chunk
-
getChunkCreatorForSparse
default IChunkFactory<K> getChunkCreatorForSparse(IChunkFactory<K> defaultChunkCreator)
Gets the chunk creator to use for the internal smaller chunk when replacing this chunk with a sparse chunk.- Parameters:
defaultChunkCreator- the chunk creator that was defined for the initial chunk that led to the creation of this chunk, possibly through several compression cycles- Returns:
- the chunk creator to use to create a sparse chunk from this chunk
-
createFrequentValueChunk
default IFrequentValueChunk<K> createFrequentValueChunk(int chunkSize, K frequentValue, IChunk<K> underlyingChunk, IRowMapping mapping, boolean hasNullValues)
Creates a compressed version of this chunk using frequency compression.- Parameters:
chunkSize- visible size of the compressed chunkunderlyingChunk- underlying chunk containing values different from the frequent valuemapping- mapping liking visible rows to each non-frequent valuehasNullValues- flag indicating if the underlying chunk contains null values.- See Also:
IFrequentValueChunk
-
-