Class WritableMemChunk

    • Constructor Summary

      Constructors 
      Constructor Description
      WritableMemChunk​(org.apache.iotdb.tsfile.write.schema.IMeasurementSchema schema)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long count()  
      org.apache.iotdb.tsfile.write.chunk.IChunkWriter createIChunkWriter()  
      int delete​(long lowerBound, long upperBound)  
      static WritableMemChunk deserialize​(java.io.DataInputStream stream)  
      void encode​(org.apache.iotdb.tsfile.write.chunk.IChunkWriter chunkWriter)  
      long getFirstPoint()  
      long getLastPoint()  
      long getMinTime()  
      org.apache.iotdb.tsfile.write.schema.IMeasurementSchema getSchema()  
      TVList getSortedTvListForQuery()
      served for query requests.
      TVList getSortedTvListForQuery​(java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> measurementSchema)
      served for vector query requests.
      TVList getTVList()  
      void putAlignedValue​(long t, java.lang.Object[] v, int[] columnOrder)  
      void putAlignedValues​(long[] t, java.lang.Object[] v, org.apache.iotdb.tsfile.utils.BitMap[] bitMaps, int[] columnOrder, int start, int end)  
      void putBinaries​(long[] t, org.apache.iotdb.tsfile.utils.Binary[] v, org.apache.iotdb.tsfile.utils.BitMap bitMap, int start, int end)  
      void putBinary​(long t, org.apache.iotdb.tsfile.utils.Binary v)  
      void putBoolean​(long t, boolean v)  
      void putBooleans​(long[] t, boolean[] v, org.apache.iotdb.tsfile.utils.BitMap bitMap, int start, int end)  
      void putDouble​(long t, double v)  
      void putDoubles​(long[] t, double[] v, org.apache.iotdb.tsfile.utils.BitMap bitMap, int start, int end)  
      void putFloat​(long t, float v)  
      void putFloats​(long[] t, float[] v, org.apache.iotdb.tsfile.utils.BitMap bitMap, int start, int end)  
      void putInt​(long t, int v)  
      void putInts​(long[] t, int[] v, org.apache.iotdb.tsfile.utils.BitMap bitMap, int start, int end)  
      void putLong​(long t, long v)  
      void putLongs​(long[] t, long[] v, org.apache.iotdb.tsfile.utils.BitMap bitMap, int start, int end)  
      void release()  
      int serializedSize()
      Calculate size after serialization.
      void serializeToWAL​(IWALByteBufferView buffer)
      Serialize using IWALByteBufferView, which encapsulates some actions to deal with BufferOverflowException occurs in ByteBuffer.
      void sortTvListForFlush()
      served for flush requests.
      java.lang.String toString()  
      void write​(long[] times, java.lang.Object valueList, org.apache.iotdb.tsfile.utils.BitMap bitMap, org.apache.iotdb.tsfile.file.metadata.enums.TSDataType dataType, int start, int end)
      write data in the range [start, end).
      void write​(long insertTime, java.lang.Object objectValue)  
      void writeAlignedValue​(long insertTime, java.lang.Object[] objectValue, java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList)  
      void writeAlignedValues​(long[] times, java.lang.Object[] valueList, org.apache.iotdb.tsfile.utils.BitMap[] bitMaps, java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList, int start, int end)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WritableMemChunk

        public WritableMemChunk​(org.apache.iotdb.tsfile.write.schema.IMeasurementSchema schema)
    • Method Detail

      • write

        public void write​(long insertTime,
                          java.lang.Object objectValue)
        Specified by:
        write in interface IWritableMemChunk
      • writeAlignedValue

        public void writeAlignedValue​(long insertTime,
                                      java.lang.Object[] objectValue,
                                      java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList)
        Specified by:
        writeAlignedValue in interface IWritableMemChunk
      • write

        public void write​(long[] times,
                          java.lang.Object valueList,
                          org.apache.iotdb.tsfile.utils.BitMap bitMap,
                          org.apache.iotdb.tsfile.file.metadata.enums.TSDataType dataType,
                          int start,
                          int end)
        Description copied from interface: IWritableMemChunk
        write data in the range [start, end). Null value in the valueList will be replaced by the subsequent non-null value, e.g., {1, null, 3, null, 5} will be {1, 3, 5, null, 5}
        Specified by:
        write in interface IWritableMemChunk
      • writeAlignedValues

        public void writeAlignedValues​(long[] times,
                                       java.lang.Object[] valueList,
                                       org.apache.iotdb.tsfile.utils.BitMap[] bitMaps,
                                       java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList,
                                       int start,
                                       int end)
        Specified by:
        writeAlignedValues in interface IWritableMemChunk
      • putBinary

        public void putBinary​(long t,
                              org.apache.iotdb.tsfile.utils.Binary v)
        Specified by:
        putBinary in interface IWritableMemChunk
      • putAlignedValue

        public void putAlignedValue​(long t,
                                    java.lang.Object[] v,
                                    int[] columnOrder)
        Specified by:
        putAlignedValue in interface IWritableMemChunk
      • putLongs

        public void putLongs​(long[] t,
                             long[] v,
                             org.apache.iotdb.tsfile.utils.BitMap bitMap,
                             int start,
                             int end)
        Specified by:
        putLongs in interface IWritableMemChunk
      • putInts

        public void putInts​(long[] t,
                            int[] v,
                            org.apache.iotdb.tsfile.utils.BitMap bitMap,
                            int start,
                            int end)
        Specified by:
        putInts in interface IWritableMemChunk
      • putFloats

        public void putFloats​(long[] t,
                              float[] v,
                              org.apache.iotdb.tsfile.utils.BitMap bitMap,
                              int start,
                              int end)
        Specified by:
        putFloats in interface IWritableMemChunk
      • putDoubles

        public void putDoubles​(long[] t,
                               double[] v,
                               org.apache.iotdb.tsfile.utils.BitMap bitMap,
                               int start,
                               int end)
        Specified by:
        putDoubles in interface IWritableMemChunk
      • putBinaries

        public void putBinaries​(long[] t,
                                org.apache.iotdb.tsfile.utils.Binary[] v,
                                org.apache.iotdb.tsfile.utils.BitMap bitMap,
                                int start,
                                int end)
        Specified by:
        putBinaries in interface IWritableMemChunk
      • putBooleans

        public void putBooleans​(long[] t,
                                boolean[] v,
                                org.apache.iotdb.tsfile.utils.BitMap bitMap,
                                int start,
                                int end)
        Specified by:
        putBooleans in interface IWritableMemChunk
      • putAlignedValues

        public void putAlignedValues​(long[] t,
                                     java.lang.Object[] v,
                                     org.apache.iotdb.tsfile.utils.BitMap[] bitMaps,
                                     int[] columnOrder,
                                     int start,
                                     int end)
        Specified by:
        putAlignedValues in interface IWritableMemChunk
      • getSortedTvListForQuery

        public TVList getSortedTvListForQuery()
        Description copied from interface: IWritableMemChunk
        served for query requests.

        if tv list has been sorted, just return reference of it

        if tv list hasn't been sorted and has no reference, sort and return reference of it

        if tv list hasn't been sorted and has reference we should copy and sort it, then return ths list

        the mechanism is just like copy on write

        This interface should be synchronized for concurrent with sortTvListForFlush

        Specified by:
        getSortedTvListForQuery in interface IWritableMemChunk
        Returns:
        sorted tv list
      • getSortedTvListForQuery

        public TVList getSortedTvListForQuery​(java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> measurementSchema)
        Description copied from interface: IWritableMemChunk
        served for vector query requests.

        the mechanism is just like copy on write

        This interface should be synchronized for concurrent with sortTvListForFlush

        Specified by:
        getSortedTvListForQuery in interface IWritableMemChunk
        Returns:
        sorted tv list
      • sortTvListForFlush

        public void sortTvListForFlush()
        Description copied from interface: IWritableMemChunk
        served for flush requests. The logic is just same as getSortedTVListForQuery, but without add reference count

        This interface should be synchronized for concurrent with getSortedTvListForQuery

        Specified by:
        sortTvListForFlush in interface IWritableMemChunk
      • getSchema

        public org.apache.iotdb.tsfile.write.schema.IMeasurementSchema getSchema()
        Specified by:
        getSchema in interface IWritableMemChunk
      • delete

        public int delete​(long lowerBound,
                          long upperBound)
        Specified by:
        delete in interface IWritableMemChunk
        Returns:
        how many points are deleted
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • encode

        public void encode​(org.apache.iotdb.tsfile.write.chunk.IChunkWriter chunkWriter)
        Specified by:
        encode in interface IWritableMemChunk
      • serializedSize

        public int serializedSize()
        Description copied from interface: SerializedSize
        Calculate size after serialization.
        Specified by:
        serializedSize in interface SerializedSize
        Returns:
        bytes number
      • deserialize

        public static WritableMemChunk deserialize​(java.io.DataInputStream stream)
                                            throws java.io.IOException
        Throws:
        java.io.IOException