Class Record
- All Implemented Interfaces:
IArray,IArrayReader,IArrayWriter,IPositionalReader,IWritableArray,IRecord,IRecordReader,IWritableRecord,IByteRecord,IWritableByteRecord,Serializable
Example: A Record stores :
| int | Date | long | long | |----- |------------ |-------- |-------- | | 0 | 12/24/2020 | null | 1L |
It is stored as: primitive data: [0 encoded over 4 bytes, 1L encoded over 8 bytes, 1L encoded over 8 bytes] (length: 20) nulls: [00000100] (length 1) is a bitmap raising a null flag using little-endian bit order. objectData [12/24/2020] (length 1)
Null values for not primitive types are stored in objectData, not in the nulls array.
- Author:
- ActiveViam
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddDouble(int position, double addedValue) Adds a double primitive value to an element of the array.voidaddFloat(int position, float addedValue) Adds a float primitive value to an element of the array.voidaddInt(int position, int addedValue) Adds a long primitive value to an element of the array.voidaddLong(int position, long addedValue) Adds a int primitive value to an element of the array.Creates a new read-only cursor that can be moved up and down the array.booleanGets the format of the record.byte[]Get the primitive data null flags (as a bitmap).intGet the offset at which the null flags are stored in the global null flag offset.Object[]Returns the array containing the objects of this record at the positionIByteRecord.getObjectDataOffset().intReturns the position where reading for objects of thisIRecordshould start.byte[]Returns the byte array including the primitive data of this record at the positionIByteRecord.getPrimitiveDataOffset().intReturns the index inIByteRecord.getPrimitiveData()where the data related to this instance is stored.inthashCode()booleanisNull(int fieldIndex) Gets whether null is stored in a given row at a given position.static intnullFlagsSize(int primitiveFieldsCount) Gets the size of the array required to store all bit flags fornullvalues forprimitiveFieldsCountprimitive fields.read(int fieldIndex) Reads a value at some index in an array.booleanreadBoolean(int fieldIndex) Reads a boolean primitive value from the array.doublereadDouble(int fieldIndex) Reads a double primitive value from the array.floatreadFloat(int fieldIndex) Reads a float primitive value from the array.intreadHashCode(int fieldIndex) Reads the hash code of the value stored at that index.intreadInt(int fieldIndex) Reads an int primitive value from the array.longreadLong(int fieldIndex) Reads a long primitive value from the array.voidtransfer(IRecordAcceptor acceptor) Transfers the content of this record into a record acceptor.voidWrites the data from this record into an existing tuple.voidtransferFromTable(ITable sourceTable, int sourceRowIndex, int[] columnIds) Transfers into thisIWritableRecordthe values that can be found in the given table, at the given row, and at the given columns.voidWrites a piece of data at a position in the array.voidwriteBoolean(int fieldIndex, boolean value) Writes a boolean primitive value in the array.voidwriteDouble(int fieldIndex, double value) Writes a double primitive value in the array.voidwriteFloat(int fieldIndex, float value) Writes a float primitive value in the array.voidwriteInt(int fieldIndex, int value) Writes an int primitive value in the array.voidwriteLong(int fieldIndex, long value) Writes a long primitive value in the array.Methods inherited from class com.activeviam.tech.records.internal.impl.ARecordReader
read, toStringMethods inherited from interface com.activeviam.tech.chunks.api.arrays.IPositionalReader
readVector
-
Method Details
-
transfer
Description copied from interface:IRecordReaderTransfers the content of this record into a record acceptor.- Specified by:
transferin interfaceIRecordReader- Parameters:
acceptor- the record acceptor
-
transfer
Description copied from interface:IRecordReaderWrites the data from this record into an existing tuple.- Specified by:
transferin interfaceIRecordReader- Parameters:
tuple- the receiving tuple
-
transferFromTable
Description copied from interface:IWritableRecordTransfers into thisIWritableRecordthe values that can be found in the given table, at the given row, and at the given columns.For each given index
iin thisIWritableRecord, the table's value at the columncolumnIds[i]and rowsourceRowIndexis written into the record, at the indexi.It is the caller's responsibility to ensure that the types won't conflict.
- Specified by:
transferFromTablein interfaceIWritableRecord- Parameters:
sourceTable- the table from which the record's data will be retrievedsourceRowIndex- the row at which the data is retrieved from the tablecolumnIds- the indexes of the column
-
getFormat
Description copied from interface:IRecordReaderGets the format of the record.- Specified by:
getFormatin interfaceIRecordReader- Returns:
- the format of the record
-
read
Description copied from interface:IPositionalReaderReads a value at some index in an array.- Specified by:
readin interfaceIPositionalReader- Parameters:
fieldIndex- 0-based index in an array- Returns:
- the data stored at that position in the array
-
readBoolean
public boolean readBoolean(int fieldIndex) Description copied from interface:IPositionalReaderReads a boolean primitive value from the array.An exception is thrown if the value is not of the right type.
- Specified by:
readBooleanin interfaceIPositionalReader- Parameters:
fieldIndex- 0-based index in an array- Returns:
- boolean value
-
readInt
public int readInt(int fieldIndex) Description copied from interface:IPositionalReaderReads an int primitive value from the array.An exception is thrown if the value is not of the right type.
- Specified by:
readIntin interfaceIPositionalReader- Parameters:
fieldIndex- 0-based index in an array- Returns:
- int value
-
readLong
public long readLong(int fieldIndex) Description copied from interface:IPositionalReaderReads a long primitive value from the array.An exception is thrown if the value is not of the right type.
- Specified by:
readLongin interfaceIPositionalReader- Parameters:
fieldIndex- 0-based index in an array- Returns:
- long value
-
readFloat
public float readFloat(int fieldIndex) Description copied from interface:IPositionalReaderReads a float primitive value from the array.An exception is thrown if the value is not of the right type.
- Specified by:
readFloatin interfaceIPositionalReader- Parameters:
fieldIndex- 0-based index in an array- Returns:
- float value
-
readDouble
public double readDouble(int fieldIndex) Description copied from interface:IPositionalReaderReads a double primitive value from the array.An exception is thrown if the value is not of the right type.
- Specified by:
readDoublein interfaceIPositionalReader- Parameters:
fieldIndex- 0-based index in an array- Returns:
- double value
-
isNull
public boolean isNull(int fieldIndex) Description copied from interface:IPositionalReaderGets whether null is stored in a given row at a given position.- Specified by:
isNullin interfaceIPositionalReader- Parameters:
fieldIndex- 0-based index in an array- Returns:
- true if the element stored at that position is null, false otherwise
-
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:
fieldIndex- 0-based index in the arrayvalue- the value to write
-
writeInt
public void writeInt(int fieldIndex, int value) Description copied from interface:IArrayWriterWrites an int primitive value in the array.- Specified by:
writeIntin interfaceIArrayWriter- Parameters:
fieldIndex- 0-based index in the arrayvalue- the value to write
-
writeDouble
public void writeDouble(int fieldIndex, double value) Description copied from interface:IArrayWriterWrites a double primitive value in the array.- Specified by:
writeDoublein interfaceIArrayWriter- Parameters:
fieldIndex- 0-based index in the arrayvalue- the value to write
-
writeBoolean
public void writeBoolean(int fieldIndex, boolean value) Description copied from interface:IArrayWriterWrites a boolean primitive value in the array.- Specified by:
writeBooleanin interfaceIArrayWriter- Parameters:
fieldIndex- 0-based index in the arrayvalue- the value to write
-
writeFloat
public void writeFloat(int fieldIndex, float value) Description copied from interface:IArrayWriterWrites a float primitive value in the array.- Specified by:
writeFloatin interfaceIArrayWriter- Parameters:
fieldIndex- 0-based index in the arrayvalue- the value to write
-
writeLong
public void writeLong(int fieldIndex, long value) Description copied from interface:IArrayWriterWrites a long primitive value in the array.- Specified by:
writeLongin interfaceIArrayWriter- Parameters:
fieldIndex- 0-based index in the arrayvalue- the value to write
-
readHashCode
public int readHashCode(int fieldIndex) Description copied from interface:IRecordReaderReads the hash code of the value stored at that index.- Specified by:
readHashCodein interfaceIRecordReader- Parameters:
fieldIndex- index of a field to read- Returns:
- hash code
-
addLong
public void addLong(int position, long addedValue) Description copied from interface:IArrayWriterAdds a int primitive value to an element of the array.- Specified by:
addLongin interfaceIArrayWriter- Parameters:
position- 0-based index in the arrayaddedValue- the value to add
-
addInt
public void addInt(int position, int addedValue) Description copied from interface:IArrayWriterAdds a long primitive value to an element of the array.- Specified by:
addIntin interfaceIArrayWriter- Parameters:
position- 0-based index in the arrayaddedValue- the value to add
-
addDouble
public void addDouble(int position, double addedValue) Description copied from interface:IArrayWriterAdds a double primitive value to an element of the array.- Specified by:
addDoublein interfaceIArrayWriter- Parameters:
position- 0-based index in the arrayaddedValue- the value to add
-
addFloat
public void addFloat(int position, float addedValue) Description copied from interface:IArrayWriterAdds a float primitive value to an element of the array.- Specified by:
addFloatin interfaceIArrayWriter- Parameters:
position- 0-based index in the arrayaddedValue- the value to add
-
nullFlagsSize
public static int nullFlagsSize(int primitiveFieldsCount) Gets the size of the array required to store all bit flags fornullvalues forprimitiveFieldsCountprimitive fields.- Parameters:
primitiveFieldsCount- the number of primitive fields- Returns:
- the size of the array
-
getPrimitiveData
public byte[] getPrimitiveData()Description copied from interface:IByteRecordReturns the byte array including the primitive data of this record at the positionIByteRecord.getPrimitiveDataOffset().- Specified by:
getPrimitiveDatain interfaceIByteRecord
-
getPrimitiveDataOffset
public int getPrimitiveDataOffset()Description copied from interface:IByteRecordReturns the index inIByteRecord.getPrimitiveData()where the data related to this instance is stored.- Specified by:
getPrimitiveDataOffsetin interfaceIByteRecord
-
getNullFlags
public byte[] getNullFlags()Description copied from interface:IByteRecordGet the primitive data null flags (as a bitmap).- Specified by:
getNullFlagsin interfaceIByteRecord
-
getNullFlagsOffset
public int getNullFlagsOffset()Description copied from interface:IByteRecordGet the offset at which the null flags are stored in the global null flag offset.- Specified by:
getNullFlagsOffsetin interfaceIByteRecord
-
getObjectData
Description copied from interface:IByteRecordReturns the array containing the objects of this record at the positionIByteRecord.getObjectDataOffset().- Specified by:
getObjectDatain interfaceIByteRecord
-
getObjectDataOffset
public int getObjectDataOffset()Description copied from interface:IByteRecordReturns the position where reading for objects of thisIRecordshould start.- Specified by:
getObjectDataOffsetin interfaceIByteRecord
-
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
-
equals
- Overrides:
equalsin classARecordReader
-
hashCode
public int hashCode()- Overrides:
hashCodein classARecordReader
-