Class DescReadWriteBatchData


  • public class DescReadWriteBatchData
    extends DescReadBatchData
    This class is for reading and writing batch data in reverse. The data source is from mergeReader. For example, the time sequence from mergeReader is 1000 -> 1, to keep the consistency that the timestamp should be ascending. It will be written in reverse, i.e. the timeRet will be [1, 1000]. Then it can be handled the same as DescReadBatchData.
    • Constructor Detail

      • DescReadWriteBatchData

        public DescReadWriteBatchData​(TSDataType dataType)
    • Method Detail

      • putBoolean

        public void putBoolean​(long t,
                               boolean v)
        put boolean data reversely.
        Overrides:
        putBoolean in class BatchData
        Parameters:
        t - timestamp
        v - boolean data
      • putInt

        public void putInt​(long t,
                           int v)
        put int data reversely.
        Overrides:
        putInt in class BatchData
        Parameters:
        t - timestamp
        v - int data
      • putLong

        public void putLong​(long t,
                            long v)
        put long data reversely.
        Overrides:
        putLong in class BatchData
        Parameters:
        t - timestamp
        v - long data
      • putFloat

        public void putFloat​(long t,
                             float v)
        put float data reversely.
        Overrides:
        putFloat in class BatchData
        Parameters:
        t - timestamp
        v - float data
      • putDouble

        public void putDouble​(long t,
                              double v)
        put double data reversely.
        Overrides:
        putDouble in class BatchData
        Parameters:
        t - timestamp
        v - double data
      • putBinary

        public void putBinary​(long t,
                              Binary v)
        put binary data reversely.
        Overrides:
        putBinary in class BatchData
        Parameters:
        t - timestamp
        v - binary data.
      • putVector

        public void putVector​(long t,
                              TsPrimitiveType[] v)
        put vector data.
        Overrides:
        putVector in class BatchData
        Parameters:
        t - timestamp
        v - vector data.
      • resetBatchData

        public void resetBatchData()
        Description copied from class: BatchData
        This method is used to reset batch data when more than one group by aggregation functions visit the same batch data
        Overrides:
        resetBatchData in class DescReadBatchData
      • getTimeByIndex

        public long getTimeByIndex​(int idx)
        Description copied from class: BatchData
        Get the idx th timestamp by the time ascending order
        Overrides:
        getTimeByIndex in class BatchData
      • getLongByIndex

        public long getLongByIndex​(int idx)
        Description copied from class: BatchData
        Get the idx th long value by the time ascending order
        Overrides:
        getLongByIndex in class BatchData
      • getDoubleByIndex

        public double getDoubleByIndex​(int idx)
        Description copied from class: BatchData
        Get the idx th double value by the time ascending order
        Overrides:
        getDoubleByIndex in class BatchData
      • getIntByIndex

        public int getIntByIndex​(int idx)
        Description copied from class: BatchData
        Get the idx th int value by the time ascending order
        Overrides:
        getIntByIndex in class BatchData
      • getFloatByIndex

        public float getFloatByIndex​(int idx)
        Description copied from class: BatchData
        Get the idx th float value by the time ascending order
        Overrides:
        getFloatByIndex in class BatchData
      • getBinaryByIndex

        public Binary getBinaryByIndex​(int idx)
        Description copied from class: BatchData
        Get the idx th binary value by the time ascending order
        Overrides:
        getBinaryByIndex in class BatchData
      • getBooleanByIndex

        public boolean getBooleanByIndex​(int idx)
        Description copied from class: BatchData
        Get the idx th boolean value by the time ascending order
        Overrides:
        getBooleanByIndex in class BatchData
      • serializeData

        public void serializeData​(java.io.DataOutputStream outputStream)
                           throws java.io.IOException
        Description copied from class: BatchData
        For any implementation of BatchData, the data serializing sequence must equal the one of writing, otherwise after deserializing the sequence will be reversed
        Overrides:
        serializeData in class BatchData
        Throws:
        java.io.IOException
      • flip

        public BatchData flip()
        Read: When put data, the writeIndex increases while the readIndex remains 0. For descending read, we need to read from writeIndex to writeCurArrayIndex
        Overrides:
        flip in class DescReadBatchData