Class AlignedChunkWriterImpl
- java.lang.Object
-
- org.apache.iotdb.tsfile.write.chunk.AlignedChunkWriterImpl
-
- All Implemented Interfaces:
IChunkWriter
public class AlignedChunkWriterImpl extends java.lang.Object implements IChunkWriter
-
-
Constructor Summary
Constructors Constructor Description AlignedChunkWriterImpl(java.util.List<IMeasurementSchema> schemaList)This is used to write 0-level file.AlignedChunkWriterImpl(IMeasurementSchema timeSchema, java.util.List<IMeasurementSchema> valueSchemaList)This is used to rewrite file.AlignedChunkWriterImpl(VectorMeasurementSchema schema)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckIsChunkSizeOverThreshold(long size, long pointNum, boolean returnTrueIfChunkEmpty)used for compaction to check whether the chunk is over threshold or not.booleancheckIsUnsealedPageOverThreshold(long size, long pointNum, boolean returnTrueIfPageEmpty)used for compaction to check whether the unsealed page is over threshold or not.voidclearPageWriter()set the current pageWriter to null, friendly for gclongestimateMaxSeriesMemSize()estimate memory usage of this series.longgetSerializedChunkSize()return the serialized size of the chunk header + all pages (not including the un-sealed page).TimeChunkWritergetTimeChunkWriter()Test onlyValueChunkWritergetValueChunkWriterByIndex(int valueIndex)java.util.List<ValueChunkWriter>getValueChunkWriterList()Test onlyvoidnextColumn()voidsealCurrentPage()seal the current page which may has not enough data points in force.voidsealCurrentTimePage()voidsealCurrentValuePage(int valueIndex)voidwrite(long time)voidwrite(long[] time, int batchSize, int arrayOffset)voidwrite(long time, boolean value, boolean isNull)voidwrite(long time, boolean value, boolean isNull, int valueIndex)voidwrite(long time, double value, boolean isNull)voidwrite(long time, double value, boolean isNull, int valueIndex)voidwrite(long time, float value, boolean isNull)voidwrite(long time, float value, boolean isNull, int valueIndex)voidwrite(long time, int value, boolean isNull)voidwrite(long time, int value, boolean isNull, int valueIndex)voidwrite(long time, long value, boolean isNull)voidwrite(long time, long value, boolean isNull, int valueIndex)voidwrite(long time, Binary value, boolean isNull)voidwrite(long time, Binary value, boolean isNull, int valueIndex)voidwrite(long time, TsPrimitiveType[] points)voidwrite(TimeColumn timeColumn, Column[] valueColumns, int batchSize)voidwriteByColumn(long time, boolean value, boolean isNull)voidwriteByColumn(long time, double value, boolean isNull)voidwriteByColumn(long time, float value, boolean isNull)voidwriteByColumn(long time, int value, boolean isNull)voidwriteByColumn(long time, long value, boolean isNull)voidwriteByColumn(long time, Binary value, boolean isNull)voidwritePageHeaderAndDataIntoTimeBuff(java.nio.ByteBuffer data, PageHeader header)voidwritePageHeaderAndDataIntoValueBuff(java.nio.ByteBuffer data, PageHeader header, int valueIndex)voidwriteTime(long time)voidwriteToFileWriter(TsFileIOWriter tsfileWriter)flush data to TsFileIOWriter.
-
-
-
Constructor Detail
-
AlignedChunkWriterImpl
public AlignedChunkWriterImpl(VectorMeasurementSchema schema)
- Parameters:
schema- schema of this measurement
-
AlignedChunkWriterImpl
public AlignedChunkWriterImpl(IMeasurementSchema timeSchema, java.util.List<IMeasurementSchema> valueSchemaList)
This is used to rewrite file. The encoding and compression of the time column should be the same as the source file.- Parameters:
timeSchema- time schemavalueSchemaList- value schema list
-
AlignedChunkWriterImpl
public AlignedChunkWriterImpl(java.util.List<IMeasurementSchema> schemaList)
This is used to write 0-level file. The compression of the time column is 'LZ4' in the configuration by default. The encoding of the time column is 'TS_2DIFF' in the configuration by default.- Parameters:
schemaList- value schema list
-
-
Method Detail
-
write
public void write(long time, int value, boolean isNull)
-
write
public void write(long time, long value, boolean isNull)
-
write
public void write(long time, boolean value, boolean isNull)
-
write
public void write(long time, float value, boolean isNull)
-
write
public void write(long time, double value, boolean isNull)
-
write
public void write(long time, Binary value, boolean isNull)
-
write
public void write(long time, int value, boolean isNull, int valueIndex)
-
write
public void write(long time, long value, boolean isNull, int valueIndex)
-
write
public void write(long time, boolean value, boolean isNull, int valueIndex)
-
write
public void write(long time, float value, boolean isNull, int valueIndex)
-
write
public void write(long time, double value, boolean isNull, int valueIndex)
-
write
public void write(long time, Binary value, boolean isNull, int valueIndex)
-
write
public void write(long time, TsPrimitiveType[] points)
-
write
public void write(long time)
-
writeTime
public void writeTime(long time)
-
write
public void write(TimeColumn timeColumn, Column[] valueColumns, int batchSize)
-
write
public void write(long[] time, int batchSize, int arrayOffset)
-
writeByColumn
public void writeByColumn(long time, int value, boolean isNull)
-
writeByColumn
public void writeByColumn(long time, long value, boolean isNull)
-
writeByColumn
public void writeByColumn(long time, boolean value, boolean isNull)
-
writeByColumn
public void writeByColumn(long time, float value, boolean isNull)
-
writeByColumn
public void writeByColumn(long time, double value, boolean isNull)
-
writeByColumn
public void writeByColumn(long time, Binary value, boolean isNull)
-
nextColumn
public void nextColumn()
-
writePageHeaderAndDataIntoTimeBuff
public void writePageHeaderAndDataIntoTimeBuff(java.nio.ByteBuffer data, PageHeader header) throws PageException- Throws:
PageException
-
writePageHeaderAndDataIntoValueBuff
public void writePageHeaderAndDataIntoValueBuff(java.nio.ByteBuffer data, PageHeader header, int valueIndex) throws PageException- Throws:
PageException
-
writeToFileWriter
public void writeToFileWriter(TsFileIOWriter tsfileWriter) throws java.io.IOException
Description copied from interface:IChunkWriterflush data to TsFileIOWriter.- Specified by:
writeToFileWriterin interfaceIChunkWriter- Throws:
java.io.IOException
-
estimateMaxSeriesMemSize
public long estimateMaxSeriesMemSize()
Description copied from interface:IChunkWriterestimate memory usage of this series.- Specified by:
estimateMaxSeriesMemSizein interfaceIChunkWriter
-
getSerializedChunkSize
public long getSerializedChunkSize()
Description copied from interface:IChunkWriterreturn the serialized size of the chunk header + all pages (not including the un-sealed page). Notice, call this method before calling writeToFileWriter(), otherwise the page buffer in memory will be cleared.
If there is no data points in the chunk, return 0 (i.e., in this case, the size of header is not calculated, because nothing will be serialized latter)>- Specified by:
getSerializedChunkSizein interfaceIChunkWriter
-
sealCurrentPage
public void sealCurrentPage()
Description copied from interface:IChunkWriterseal the current page which may has not enough data points in force.- Specified by:
sealCurrentPagein interfaceIChunkWriter
-
sealCurrentTimePage
public void sealCurrentTimePage()
-
sealCurrentValuePage
public void sealCurrentValuePage(int valueIndex)
-
clearPageWriter
public void clearPageWriter()
Description copied from interface:IChunkWriterset the current pageWriter to null, friendly for gc- Specified by:
clearPageWriterin interfaceIChunkWriter
-
checkIsChunkSizeOverThreshold
public boolean checkIsChunkSizeOverThreshold(long size, long pointNum, boolean returnTrueIfChunkEmpty)Description copied from interface:IChunkWriterused for compaction to check whether the chunk is over threshold or not. Return true if there is no unsealed chunk.- Specified by:
checkIsChunkSizeOverThresholdin interfaceIChunkWriter
-
checkIsUnsealedPageOverThreshold
public boolean checkIsUnsealedPageOverThreshold(long size, long pointNum, boolean returnTrueIfPageEmpty)Description copied from interface:IChunkWriterused for compaction to check whether the unsealed page is over threshold or not. Return true if there is no unsealed page.- Specified by:
checkIsUnsealedPageOverThresholdin interfaceIChunkWriter
-
getValueChunkWriterByIndex
public ValueChunkWriter getValueChunkWriterByIndex(int valueIndex)
-
getTimeChunkWriter
public TimeChunkWriter getTimeChunkWriter()
Test only
-
getValueChunkWriterList
public java.util.List<ValueChunkWriter> getValueChunkWriterList()
Test only
-
-