Class ChunkWriterImpl
- java.lang.Object
-
- org.apache.iotdb.tsfile.write.chunk.ChunkWriterImpl
-
- All Implemented Interfaces:
IChunkWriter
public class ChunkWriterImpl extends java.lang.Object implements IChunkWriter
-
-
Constructor Summary
Constructors Constructor Description ChunkWriterImpl(IMeasurementSchema schema)ChunkWriterImpl(IMeasurementSchema schema, boolean isMerging)
-
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.TSDataTypegetDataType()PageWritergetPageWriter()Only used for tests.longgetSerializedChunkSize()return the serialized size of the chunk header + all pages (not including the un-sealed page).booleanisMerging()voidsealCurrentPage()seal the current page which may has not enough data points in force.voidsetIsMerging(boolean isMerging)voidsetLastPoint(boolean isLastPoint)voidwrite(long[] timestamps, boolean[] values, int batchSize)voidwrite(long[] timestamps, double[] values, int batchSize)voidwrite(long[] timestamps, float[] values, int batchSize)voidwrite(long[] timestamps, int[] values, int batchSize)voidwrite(long[] timestamps, long[] values, int batchSize)voidwrite(long[] timestamps, Binary[] values, int batchSize)voidwrite(long time, boolean value)voidwrite(long time, double value)voidwrite(long time, float value)voidwrite(long time, int value)voidwrite(long time, long value)voidwrite(long time, Binary value)voidwritePageHeaderAndDataIntoBuff(java.nio.ByteBuffer data, PageHeader header)write the page header and data into the PageWriter's output stream.voidwriteToFileWriter(TsFileIOWriter tsfileWriter)flush data to TsFileIOWriter.
-
-
-
Constructor Detail
-
ChunkWriterImpl
public ChunkWriterImpl(IMeasurementSchema schema)
- Parameters:
schema- schema of this measurement
-
ChunkWriterImpl
public ChunkWriterImpl(IMeasurementSchema schema, boolean isMerging)
-
-
Method Detail
-
write
public void write(long time, long value)
-
write
public void write(long time, int value)
-
write
public void write(long time, boolean value)
-
write
public void write(long time, float value)
-
write
public void write(long time, double value)
-
write
public void write(long time, Binary value)
-
write
public void write(long[] timestamps, int[] values, int batchSize)
-
write
public void write(long[] timestamps, long[] values, int batchSize)
-
write
public void write(long[] timestamps, boolean[] values, int batchSize)
-
write
public void write(long[] timestamps, float[] values, int batchSize)
-
write
public void write(long[] timestamps, double[] values, int batchSize)
-
write
public void write(long[] timestamps, Binary[] values, int batchSize)
-
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
-
clearPageWriter
public void clearPageWriter()
Description copied from interface:IChunkWriterset the current pageWriter to null, friendly for gc- Specified by:
clearPageWriterin 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
-
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
-
getDataType
public TSDataType getDataType()
-
writePageHeaderAndDataIntoBuff
public void writePageHeaderAndDataIntoBuff(java.nio.ByteBuffer data, PageHeader header) throws PageExceptionwrite the page header and data into the PageWriter's output stream. @NOTE: for upgrading 0.11/v2 to 0.12/v3 TsFile- Throws:
PageException
-
setIsMerging
public void setIsMerging(boolean isMerging)
-
isMerging
public boolean isMerging()
-
setLastPoint
public void setLastPoint(boolean isLastPoint)
-
getPageWriter
public PageWriter getPageWriter()
Only used for tests.
-
-