Interface IChunkInteger
- All Superinterfaces:
IArray,IArrayReader,IArrayWriter,IChunk<Integer>,IMemoryMonitored,IWritableArray
- All Known Subinterfaces:
IChunkPositiveInteger,IChunkPrimitiveInteger,IConcurrentChunkInteger
- All Known Implementing Classes:
AChunkPositiveInteger,AChunkPrimitiveInteger,ADirectChunkPrimitiveInteger,ArrayChunkBits,ArrayChunkBytes,ArrayChunkHexa,ArrayChunkInteger,ArrayChunkIntegerNullable,ArrayChunkPositiveInteger,ArrayChunkQuad,ArrayChunkShorts,ArrayChunkTriBytes,BufferChunkPositiveInteger,BufferChunkPrimitiveBits,BufferChunkPrimitiveBytes,BufferChunkPrimitiveHexa,BufferChunkPrimitiveInts,BufferChunkPrimitiveIntsNullable,BufferChunkPrimitiveQuad,BufferChunkPrimitiveShorts,BufferChunkPrimitiveTriBytes,ChunkOffsetInteger,ChunkSingleInteger,DirectChunkBits,DirectChunkBytes,DirectChunkHexa,DirectChunkInteger,DirectChunkIntegerNullable,DirectChunkPositiveInteger,DirectChunkQuad,DirectChunkShorts,DirectChunkTriBytes,FrequentIntegerChunk,FrequentNullIntegerChunk,NullableFrequentIntegerChunk
Specialized primitive read operations access the physical storage directly and ignore null
checks, so when dealing with implementations that support null values, the IArrayReader.isNull(int)
method must be called before reading the value.
Implementations must override the readInt(int) and writeInt(int, int)
methods that are used in all default implementations within this interface.
- Author:
- ActiveViam
-
Field Summary
Fields inherited from interface com.qfs.chunk.IChunk
NO_SIZE_LIMIT -
Method Summary
Modifier and TypeMethodDescriptionstatic intcomputeOrder(int bitsUsed) Computes the order of the chunks that can hold the data.default voidcopyInto(int position, IWritableCell cell) Copies the value at a given position in this chunk into the provided cell.default IFrequentValueChunk<Integer>createFrequentValueChunk(int chunkSize, Integer frequentValue, IChunk<Integer> underlyingChunk, IRowMapping mapping, boolean hasNullValues) Creates a compressed version of this chunk using frequency compression.booleanequals(int position, int value) Tests if the record stored at that position is equal to a value.default voidfill(int value) Fills all slots in the chunk with the same value.default intGets the type for binding transfers of this chunk.default intgetOrder()Gets this chunk order, i.e.default booleanReturns whether this chunk contains primitive data, as perTypes.isPrimitive(int).read(int position) Returns the data stored at that position in the chunk.doublereadDouble(int position) Reads a double primitive value from the array.floatreadFloat(int position) Reads a float primitive value from the array.intreadInt(int position) Reads an int primitive value from the array.longreadLong(int position) Reads a long primitive value from the array.default 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.voidWrites a piece of data at a position in the array.default voidwriteFromCell(int position, IReadableCell cell) Writes the content of the cell into the chunk at the given position.voidwriteInt(int position, int value) Writes an int primitive value in the array.Methods inherited from interface com.qfs.chunk.IArrayReader
isNull, readBoolean, readVectorMethods inherited from interface com.qfs.chunk.IArrayWriter
addDouble, addFloat, addInt, addLong, writeBoolean, writeDouble, writeFloat, writeLongMethods inherited from interface com.qfs.chunk.IChunk
capacity, compress, createArrayCursor, destroy, findRowsEqualTo, findRowsEqualTo, findRowsEqualTo, findRowsInSet, findRowsInSet, findRowsInSet, findRowsInTransactionEqualTo, findRowsInTransactionEqualTo, findRowsInTransactionEqualTo, findRowsInTransactionInSet, findRowsInTransactionInSet, findRowsInTransactionInSet, freeRow, getChunkCreatorForSparse, getChunkId, getChunkType, getPhysicalSize, isDead, localRow, replaceBy, reset, sparseChunkCompressionMethods inherited from interface com.qfs.monitoring.memory.IMemoryMonitored
getMemoryStatistic
-
Method Details
-
isPrimitive
default boolean isPrimitive()Description copied from interface:IChunkReturns whether this chunk contains primitive data, as perTypes.isPrimitive(int).- Specified by:
isPrimitivein interfaceIChunk<Integer>- Returns:
trueif this chunk contains primitive data, as perTypes.isPrimitive(int),falseotherwise
-
getBindingType
default int getBindingType()Description copied from interface:IChunkGets the type for binding transfers of this chunk.- Specified by:
getBindingTypein interfaceIChunk<Integer>- Returns:
- the physical type like
Types.PHYSICAL_INT, etc
-
copyInto
Description copied from interface:IChunkCopies the value at a given position in this chunk into the provided cell. -
writeFromCell
Description copied from interface:IChunkWrites 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.
- Specified by:
writeFromCellin interfaceIChunk<Integer>
-
fill
default void fill(int value) Fills all slots in the chunk with the same value.- Parameters:
value- the value to fill the chunk with
-
equals
boolean equals(int position, int value) Tests if the record stored at that position is equal to a value.- Parameters:
position- the position to readvalue- the value to compare- Returns:
trueif the read value is the same as the given value,falseotherwise
-
getOrder
default int getOrder()Gets this chunk order, i.e. the number of bits used to represent this chunk data.If the actual data can be represented with less bits, the compression will create a chunk with a lower order.
- Returns:
- the current chunk order
-
computeOrder
static int computeOrder(int bitsUsed) Computes the order of the chunks that can hold the data.- Parameters:
bitsUsed- the number of bits used in the chunk- Returns:
- the order of the chunks that can hold the data
-
read
Description copied from interface:IChunkReturns the data stored at that position in the chunk.- Specified by:
readin interfaceIArrayReader- Specified by:
readin interfaceIChunk<Integer>- Parameters:
position- the position in the chunk at which to read- Returns:
- the data stored at that position in the chunk
-
readInt
int readInt(int position) Description copied from interface:IArrayReaderReads an int primitive value from the array.An exception is thrown if the value is not of the right type.
- Specified by:
readIntin interfaceIArrayReader- Parameters:
position- 0-based index in an array- Returns:
- int value
-
readLong
long readLong(int position) Description copied from interface:IArrayReaderReads a long primitive value from the array.An exception is thrown if the value is not of the right type.
- Specified by:
readLongin interfaceIArrayReader- Parameters:
position- 0-based index in an array- Returns:
- long value
-
readFloat
float readFloat(int position) Description copied from interface:IArrayReaderReads a float primitive value from the array.An exception is thrown if the value is not of the right type.
- Specified by:
readFloatin interfaceIArrayReader- Parameters:
position- 0-based index in an array- Returns:
- float value
-
readDouble
double readDouble(int position) Description copied from interface:IArrayReaderReads a double primitive value from the array.An exception is thrown if the value is not of the right type.
- Specified by:
readDoublein interfaceIArrayReader- Parameters:
position- 0-based index in an array- Returns:
- double value
-
write
Description copied from interface:IArrayWriterWrites a piece of data at a position in the array.For better performance, use the primitive type operations.
- Specified by:
writein interfaceIArrayWriter- Parameters:
position- 0-based index in the arrayvalue- the value to write
-
writeInt
void writeInt(int position, int value) Description copied from interface:IArrayWriterWrites an int primitive value in the array.- Specified by:
writeIntin interfaceIArrayWriter- Parameters:
position- 0-based index in the arrayvalue- the value to write
-
transfer
default void transfer(IWritableTable destination, int destinationColumn, int[] rowsMapping, int numRows) Description copied from interface:IChunkTransfers 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. -
createFrequentValueChunk
default IFrequentValueChunk<Integer> createFrequentValueChunk(int chunkSize, Integer frequentValue, IChunk<Integer> underlyingChunk, IRowMapping mapping, boolean hasNullValues) Description copied from interface:IChunkCreates a compressed version of this chunk using frequency compression.- Specified by:
createFrequentValueChunkin interfaceIChunk<Integer>- 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:
-