Class AggregateResult

    • Field Detail

      • TIME_LENGTH_FOR_FIRST_VALUE

        public static final int TIME_LENGTH_FOR_FIRST_VALUE
        See Also:
        Constant Field Values
      • resultDataType

        protected org.apache.iotdb.tsfile.file.metadata.enums.TSDataType resultDataType
      • timestamp

        protected long timestamp
        For [COUNT, AVG, SUM], it is the start time of the aggregation window.

        For [MAX_VALUE, MIN_VALUE, EXTREME, FIRST_VALUE, LAST_VALUE], it is the timestamp of the current value.

        For [MAX_TIME, MIN_TIME], it is always null.

      • hasCandidateResult

        protected boolean hasCandidateResult
    • Constructor Detail

      • AggregateResult

        public AggregateResult​(org.apache.iotdb.tsfile.file.metadata.enums.TSDataType resultDataType,
                               AggregationType aggregationType)
        construct.
        Parameters:
        resultDataType - result data type.
    • Method Detail

      • getResult

        public abstract java.lang.Object getResult()
      • updateResultFromStatistics

        public abstract void updateResultFromStatistics​(org.apache.iotdb.tsfile.file.metadata.statistics.Statistics statistics)
                                                 throws QueryProcessException
        Calculate the aggregation using Statistics
        Parameters:
        statistics - chunkStatistics or pageStatistics
        Throws:
        QueryProcessException
      • updateResultFromPageData

        public abstract void updateResultFromPageData​(org.apache.iotdb.tsfile.read.common.IBatchDataIterator batchIterator)
                                               throws java.io.IOException,
                                                      QueryProcessException
        Aggregate results cannot be calculated using Statistics directly, using the data in each page. This method is used in global aggregation query.
        Parameters:
        batchIterator - the data in Page
        Throws:
        java.io.IOException
        QueryProcessException
      • updateResultFromPageData

        public abstract void updateResultFromPageData​(org.apache.iotdb.tsfile.read.common.IBatchDataIterator batchIterator,
                                                      long minBound,
                                                      long maxBound)
                                               throws java.io.IOException
        Aggregate results cannot be calculated using Statistics directly, using the data in each page. This method is used in GROUP BY aggregation query.
        Parameters:
        batchIterator - the data in Page
        minBound - calculate points whose time >= bound
        maxBound - calculate points whose time < bound
        Throws:
        java.io.IOException
      • updateResultUsingTimestamps

        public abstract void updateResultUsingTimestamps​(long[] timestamps,
                                                         int length,
                                                         IReaderByTimestamp dataReader)
                                                  throws java.io.IOException
        This method calculates the aggregation using common timestamps of the cross series filter.
        Throws:
        java.io.IOException - TsFile data read error
      • updateResultUsingValues

        public abstract void updateResultUsingValues​(long[] timestamps,
                                                     int length,
                                                     ValueIterator valueIterator)
        This method calculates the aggregation using values that have been calculated
      • hasFinalResult

        public abstract boolean hasFinalResult()
        Judge if aggregation results have been calculated. In other words, if the aggregated result does not need to compute the remaining data, it returns true.
        Returns:
        If the aggregation result has been calculated return true, else return false.
      • merge

        public abstract void merge​(AggregateResult another)
        Merge another aggregateResult into this
      • deserializeFrom

        public static AggregateResult deserializeFrom​(java.nio.ByteBuffer buffer)
      • deserializeSpecificFields

        protected abstract void deserializeSpecificFields​(java.nio.ByteBuffer buffer)
      • serialize

        public void serialize​(java.nio.ByteBuffer byteBuffer)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • serializeTo

        public void serializeTo​(java.io.OutputStream outputStream)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • serializeSpecificFields

        protected abstract void serializeSpecificFields​(java.io.OutputStream outputStream)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • reset

        public void reset()
      • getValue

        protected java.lang.Object getValue()
      • setValue

        protected void setValue​(java.lang.Object v)
        set an object.
        Parameters:
        v - object value
      • getResultDataType

        public org.apache.iotdb.tsfile.file.metadata.enums.TSDataType getResultDataType()
      • getBooleanValue

        protected boolean getBooleanValue()
      • setBooleanValue

        public void setBooleanValue​(boolean booleanValue)
      • getIntValue

        public int getIntValue()
      • getIntAbsValue

        public int getIntAbsValue()
      • setIntValue

        public void setIntValue​(int intValue)
      • getLongValue

        public long getLongValue()
      • getLongAbsValue

        public long getLongAbsValue()
      • setLongValue

        public void setLongValue​(long longValue)
      • getFloatValue

        public float getFloatValue()
      • getFloatAbsValue

        public float getFloatAbsValue()
      • setFloatValue

        public void setFloatValue​(float floatValue)
      • getDoubleValue

        public double getDoubleValue()
      • getDoubleAbsValue

        public double getDoubleAbsValue()
      • setDoubleValue

        public void setDoubleValue​(double doubleValue)
      • getBinaryValue

        protected org.apache.iotdb.tsfile.utils.Binary getBinaryValue()
      • setBinaryValue

        public void setBinaryValue​(org.apache.iotdb.tsfile.utils.Binary binaryValue)
      • setTime

        public void setTime​(long timestamp)
      • getTime

        public long getTime()
      • hasCandidateResult

        protected boolean hasCandidateResult()
      • toString

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

        public boolean isAscending()
        Whether the AggregationResult accepts data in time ascending order, if it returns false, the data should be passed in time descending order.
      • clone

        public AggregateResult clone()
        Overrides:
        clone in class java.lang.Object