Class AlignedChunkWriterImpl

  • All Implemented Interfaces:
    IChunkWriter

    public class AlignedChunkWriterImpl
    extends java.lang.Object
    implements IChunkWriter
    • 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 schema
        valueSchemaList - 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)
      • 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()
      • 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: IChunkWriter
        flush data to TsFileIOWriter.
        Specified by:
        writeToFileWriter in interface IChunkWriter
        Throws:
        java.io.IOException
      • getSerializedChunkSize

        public long getSerializedChunkSize()
        Description copied from interface: IChunkWriter
        return 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:
        getSerializedChunkSize in interface IChunkWriter
      • sealCurrentPage

        public void sealCurrentPage()
        Description copied from interface: IChunkWriter
        seal the current page which may has not enough data points in force.
        Specified by:
        sealCurrentPage in interface IChunkWriter
      • sealCurrentTimePage

        public void sealCurrentTimePage()
      • sealCurrentValuePage

        public void sealCurrentValuePage​(int valueIndex)
      • clearPageWriter

        public void clearPageWriter()
        Description copied from interface: IChunkWriter
        set the current pageWriter to null, friendly for gc
        Specified by:
        clearPageWriter in interface IChunkWriter
      • checkIsChunkSizeOverThreshold

        public boolean checkIsChunkSizeOverThreshold​(long size,
                                                     long pointNum,
                                                     boolean returnTrueIfChunkEmpty)
        Description copied from interface: IChunkWriter
        used for compaction to check whether the chunk is over threshold or not. Return true if there is no unsealed chunk.
        Specified by:
        checkIsChunkSizeOverThreshold in interface IChunkWriter
      • checkIsUnsealedPageOverThreshold

        public boolean checkIsUnsealedPageOverThreshold​(long size,
                                                        long pointNum,
                                                        boolean returnTrueIfPageEmpty)
        Description copied from interface: IChunkWriter
        used for compaction to check whether the unsealed page is over threshold or not. Return true if there is no unsealed page.
        Specified by:
        checkIsUnsealedPageOverThreshold in interface IChunkWriter
      • getValueChunkWriterByIndex

        public ValueChunkWriter getValueChunkWriterByIndex​(int valueIndex)
      • getTimeChunkWriter

        public TimeChunkWriter getTimeChunkWriter()
        Test only
      • getValueChunkWriterList

        public java.util.List<ValueChunkWriter> getValueChunkWriterList()
        Test only