Class Tablet
- java.lang.Object
-
- org.apache.iotdb.tsfile.write.record.Tablet
-
public class Tablet extends java.lang.ObjectA tablet data of one device, the tablet contains multiple measurements of this device that share the same time column.for example: device root.sg1.d1
time, m1, m2, m3 1, 1, 2, 3 2, 1, 2, 3 3, 1, 2, 3
Notice: The tablet should not have empty cell, please use BitMap to denote null value
-
-
Field Summary
Fields Modifier and Type Field Description BitMap[]bitMapseach bitmap represents the existence of each value in the current column.java.lang.StringdeviceIddeviceId of this tabletintrowSizethe number of rows to include in this tabletlong[]timestampstimestamps in this tabletjava.lang.Object[]valueseach object is a primitive type array, which represents values of one measurement
-
Constructor Summary
Constructors Constructor Description Tablet(java.lang.String deviceId, java.util.List<MeasurementSchema> schemas)Return a tablet with default specified row number.Tablet(java.lang.String deviceId, java.util.List<MeasurementSchema> schemas, int maxRowNumber)Return a tablet with the specified number of rows (maxBatchSize).Tablet(java.lang.String deviceId, java.util.List<MeasurementSchema> schemas, long[] timestamps, java.lang.Object[] values, BitMap[] bitMaps, int maxRowNumber)Return a tablet with specified timestamps and values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTimestamp(int rowIndex, long timestamp)voidaddValue(java.lang.String measurementId, int rowIndex, java.lang.Object value)static Tabletdeserialize(java.nio.ByteBuffer byteBuffer)Deserialize Tabletbooleanequals(java.lang.Object o)intgetMaxRowNumber()Return the maximum number of rows for this tabletjava.util.List<MeasurementSchema>getSchemas()intgetTimeBytesSize()intgetTotalValueOccupation()voidinitBitMaps()static BitMap[]readBitMapsFromBuffer(java.nio.ByteBuffer byteBuffer, int columns)deserialize bitmapsstatic java.lang.Object[]readTabletValuesFromBuffer(java.nio.ByteBuffer byteBuffer, TSDataType[] types, int columns, int rowSize)voidreset()Reset Tablet to the default state - set the rowSize to 0 and reset bitMapsjava.nio.ByteBufferserialize()serialize Tabletvoidserialize(java.io.DataOutputStream stream)voidsetDeviceId(java.lang.String deviceId)voidsetSchemas(java.util.List<MeasurementSchema> schemas)
-
-
-
Field Detail
-
deviceId
public java.lang.String deviceId
deviceId of this tablet
-
timestamps
public long[] timestamps
timestamps in this tablet
-
values
public java.lang.Object[] values
each object is a primitive type array, which represents values of one measurement
-
bitMaps
public BitMap[] bitMaps
each bitmap represents the existence of each value in the current column.
-
rowSize
public int rowSize
the number of rows to include in this tablet
-
-
Constructor Detail
-
Tablet
public Tablet(java.lang.String deviceId, java.util.List<MeasurementSchema> schemas)Return a tablet with default specified row number. This is the standard constructor (all Tablet should be the same size).- Parameters:
deviceId- the name of the device specified to be written inschemas- the list of measurement schemas for creating the tablet, only measurementId and type take effects
-
Tablet
public Tablet(java.lang.String deviceId, java.util.List<MeasurementSchema> schemas, int maxRowNumber)Return a tablet with the specified number of rows (maxBatchSize). Only call this constructor directly for testing purposes. Tablet should normally always be default size.- Parameters:
deviceId- the name of the device specified to be written inschemas- the list of measurement schemas for creating the row batch, only measurementId and type take effectsmaxRowNumber- the maximum number of rows for this tablet
-
Tablet
public Tablet(java.lang.String deviceId, java.util.List<MeasurementSchema> schemas, long[] timestamps, java.lang.Object[] values, BitMap[] bitMaps, int maxRowNumber)Return a tablet with specified timestamps and values. Only call this constructor directly for Trigger.- Parameters:
deviceId- the name of the device specified to be written inschemas- the list of measurement schemas for creating the row batch, only measurementId and type take effectstimestamps- given timestampsvalues- given valuesbitMaps- given bitmapsmaxRowNumber- the maximum number of rows for this tablet
-
-
Method Detail
-
setDeviceId
public void setDeviceId(java.lang.String deviceId)
-
setSchemas
public void setSchemas(java.util.List<MeasurementSchema> schemas)
-
initBitMaps
public void initBitMaps()
-
addTimestamp
public void addTimestamp(int rowIndex, long timestamp)
-
addValue
public void addValue(java.lang.String measurementId, int rowIndex, java.lang.Object value)
-
getSchemas
public java.util.List<MeasurementSchema> getSchemas()
-
getMaxRowNumber
public int getMaxRowNumber()
Return the maximum number of rows for this tablet
-
reset
public void reset()
Reset Tablet to the default state - set the rowSize to 0 and reset bitMaps
-
getTimeBytesSize
public int getTimeBytesSize()
-
getTotalValueOccupation
public int getTotalValueOccupation()
- Returns:
- total bytes of values
-
serialize
public java.nio.ByteBuffer serialize() throws java.io.IOExceptionserialize Tablet- Throws:
java.io.IOException
-
serialize
public void serialize(java.io.DataOutputStream stream) throws java.io.IOException- Throws:
java.io.IOException
-
deserialize
public static Tablet deserialize(java.nio.ByteBuffer byteBuffer)
Deserialize Tablet
-
readBitMapsFromBuffer
public static BitMap[] readBitMapsFromBuffer(java.nio.ByteBuffer byteBuffer, int columns)
deserialize bitmaps
-
readTabletValuesFromBuffer
public static java.lang.Object[] readTabletValuesFromBuffer(java.nio.ByteBuffer byteBuffer, TSDataType[] types, int columns, int rowSize)- Parameters:
byteBuffer- data valuescolumns- column number
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-