You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2022/02/07 08:21:27 UTC

[iotdb] branch master updated: Removing some useless codes in Statistics (#4978)

This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new ec650d2  Removing some useless codes in Statistics (#4978)
ec650d2 is described below

commit ec650d2e1ad39e1f1b9d35a2fd0e425e4cda9408
Author: Yuyuan Kang <36...@users.noreply.github.com>
AuthorDate: Mon Feb 7 16:20:49 2022 +0800

    Removing some useless codes in Statistics (#4978)
---
 .../aggregation/IoTDBAggregationLargeDataIT.java   | 28 ++++----
 .../aggregation/IoTDBAggregationSmallDataIT.java   | 10 +--
 .../file/metadata/statistics/BinaryStatistics.java | 68 +++----------------
 .../metadata/statistics/BooleanStatistics.java     | 65 +++---------------
 .../file/metadata/statistics/DoubleStatistics.java | 64 ++----------------
 .../file/metadata/statistics/FloatStatistics.java  | 64 ++----------------
 .../metadata/statistics/IntegerStatistics.java     | 64 ++----------------
 .../file/metadata/statistics/LongStatistics.java   | 64 ++----------------
 .../file/metadata/statistics/Statistics.java       | 24 +------
 .../file/metadata/statistics/TimeStatistics.java   | 78 ++++------------------
 10 files changed, 76 insertions(+), 453 deletions(-)

diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationLargeDataIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationLargeDataIT.java
index f3dde27..21aa762 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationLargeDataIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationLargeDataIT.java
@@ -214,7 +214,7 @@ public class IoTDBAggregationLargeDataIT {
                   + resultSet.getString(sum(d0s1))
                   + ","
                   + Math.round(resultSet.getDouble(sum(d0s2)));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
@@ -236,7 +236,7 @@ public class IoTDBAggregationLargeDataIT {
                   + resultSet.getString(sum(d0s1))
                   + ","
                   + Math.round(resultSet.getDouble(sum(d0s2)));
-          Assert.assertEquals(ans, retArray[retArray.length - cnt - 1]);
+          Assert.assertEquals(retArray[retArray.length - cnt - 1], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
@@ -274,7 +274,7 @@ public class IoTDBAggregationLargeDataIT {
                   + resultSet.getString(firstValue(d0s3))
                   + ","
                   + resultSet.getString(firstValue(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
@@ -301,7 +301,7 @@ public class IoTDBAggregationLargeDataIT {
                   + resultSet.getString(firstValue(d0s3))
                   + ","
                   + resultSet.getString(firstValue(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
@@ -446,7 +446,7 @@ public class IoTDBAggregationLargeDataIT {
                   + resultSet.getString(minTime(d0s3))
                   + ","
                   + resultSet.getString(minTime(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
@@ -473,7 +473,7 @@ public class IoTDBAggregationLargeDataIT {
                   + resultSet.getString(minTime(d0s3))
                   + ","
                   + resultSet.getString(minTime(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
@@ -507,7 +507,7 @@ public class IoTDBAggregationLargeDataIT {
                     + resultSet.getString(minValue(d0s1))
                     + ","
                     + resultSet.getString(minValue(d0s2));
-            Assert.assertEquals(ans, retArray[cnt]);
+            Assert.assertEquals(retArray[cnt], ans);
             cnt++;
           }
           Assert.assertEquals(1, cnt);
@@ -531,7 +531,7 @@ public class IoTDBAggregationLargeDataIT {
                     + resultSet.getString(minValue(d0s1))
                     + ","
                     + resultSet.getString(minValue(d0s2));
-            Assert.assertEquals(ans, retArray[cnt]);
+            Assert.assertEquals(retArray[cnt], ans);
             cnt++;
           }
           Assert.assertEquals(1, cnt);
@@ -567,7 +567,7 @@ public class IoTDBAggregationLargeDataIT {
                     + resultSet.getString(maxValue(d0s1))
                     + ","
                     + resultSet.getString(maxValue(d0s2));
-            Assert.assertEquals(ans, retArray[cnt]);
+            Assert.assertEquals(retArray[cnt], ans);
             cnt++;
           }
           Assert.assertEquals(1, cnt);
@@ -591,7 +591,7 @@ public class IoTDBAggregationLargeDataIT {
                     + resultSet.getString(maxValue(d0s1))
                     + ","
                     + resultSet.getString(maxValue(d0s2));
-            Assert.assertEquals(ans, retArray[cnt]);
+            Assert.assertEquals(retArray[cnt], ans);
             cnt++;
           }
           Assert.assertEquals(1, cnt);
@@ -628,7 +628,7 @@ public class IoTDBAggregationLargeDataIT {
                     + resultSet.getString(extreme(d0s1))
                     + ","
                     + resultSet.getString(extreme(d0s2));
-            Assert.assertEquals(ans, retArray[cnt]);
+            Assert.assertEquals(retArray[cnt], ans);
             cnt++;
           }
           Assert.assertEquals(1, cnt);
@@ -653,7 +653,7 @@ public class IoTDBAggregationLargeDataIT {
                     + resultSet.getString(extreme(d0s1))
                     + ","
                     + resultSet.getString(extreme(d0s2));
-            Assert.assertEquals(ans, retArray[cnt]);
+            Assert.assertEquals(retArray[cnt], ans);
             cnt++;
           }
           Assert.assertEquals(1, cnt);
@@ -890,7 +890,7 @@ public class IoTDBAggregationLargeDataIT {
                   + resultSet.getString(maxTime(d0s3))
                   + ","
                   + resultSet.getString(maxTime(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
@@ -917,7 +917,7 @@ public class IoTDBAggregationLargeDataIT {
                   + resultSet.getString(maxTime(d0s3))
                   + ","
                   + resultSet.getString(maxTime(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationSmallDataIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationSmallDataIT.java
index 4a04675..aaec4be 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationSmallDataIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationSmallDataIT.java
@@ -563,7 +563,7 @@ public class IoTDBAggregationSmallDataIT {
                   + resultSet.getString(minTime(d0s3))
                   + ","
                   + resultSet.getString(minTime(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
           Assert.assertEquals(1, cnt);
         }
@@ -601,7 +601,7 @@ public class IoTDBAggregationSmallDataIT {
                   + resultSet.getString(maxTime(d0s3))
                   + ","
                   + resultSet.getString(maxTime(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
@@ -635,7 +635,7 @@ public class IoTDBAggregationSmallDataIT {
                   + resultSet.getString(minValue(d0s1))
                   + ","
                   + resultSet.getString(minValue(d0s2));
-          Assert.assertEquals(ans, retArray[cnt]);
+          Assert.assertEquals(retArray[cnt], ans);
           cnt++;
         }
         Assert.assertEquals(1, cnt);
@@ -758,7 +758,7 @@ public class IoTDBAggregationSmallDataIT {
                     + resultSet.getString(d0s3)
                     + ","
                     + resultSet.getString(d1s0);
-            Assert.assertEquals(ans, retArray[cnt]);
+            Assert.assertEquals(retArray[cnt], ans);
             cnt++;
           }
           Assert.assertEquals(17, cnt);
@@ -772,7 +772,7 @@ public class IoTDBAggregationSmallDataIT {
           int cnt = 0;
           while (resultSet.next()) {
             String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(d0s4);
-            Assert.assertEquals(ans, retArray[cnt]);
+            Assert.assertEquals(retArray[cnt], ans);
             cnt++;
           }
           Assert.assertEquals(1, cnt);
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/BinaryStatistics.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/BinaryStatistics.java
index 440844f..b2ba5b7 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/BinaryStatistics.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/BinaryStatistics.java
@@ -35,8 +35,7 @@ public class BinaryStatistics extends Statistics<Binary> {
 
   private Binary firstValue = new Binary("");
   private Binary lastValue = new Binary("");
-  private static final String BINARY_STATS_UNSUPPORTED_MSG =
-      "Binary statistics does not support: %s";
+  private static final String BINARY = "Binary";
   static final int BINARY_STATISTICS_FIXED_RAM_SIZE = 32;
 
   @Override
@@ -44,6 +43,10 @@ public class BinaryStatistics extends Statistics<Binary> {
     return TSDataType.TEXT;
   }
 
+  /**
+   * The output of this method should be identical to the method "serializeStats(OutputStream
+   * outputStream)"
+   */
   @Override
   public int getStatsSize() {
     return 4 + firstValue.getValues().length + 4 + lastValue.getValues().length;
@@ -77,16 +80,13 @@ public class BinaryStatistics extends Statistics<Binary> {
   }
 
   @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {}
-
-  @Override
   public Binary getMinValue() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "min"));
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, BINARY, "min"));
   }
 
   @Override
   public Binary getMaxValue() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "max"));
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, BINARY, "max"));
   }
 
   @Override
@@ -101,12 +101,12 @@ public class BinaryStatistics extends Statistics<Binary> {
 
   @Override
   public double getSumDoubleValue() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "double sum"));
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, BINARY, "double sum"));
   }
 
   @Override
   public long getSumLongValue() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "long sum"));
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, BINARY, "long sum"));
   }
 
   @Override
@@ -147,56 +147,6 @@ public class BinaryStatistics extends Statistics<Binary> {
   }
 
   @Override
-  public byte[] getMinValueBytes() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "min"));
-  }
-
-  @Override
-  public byte[] getMaxValueBytes() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "max"));
-  }
-
-  @Override
-  public byte[] getFirstValueBytes() {
-    return firstValue.getValues();
-  }
-
-  @Override
-  public byte[] getLastValueBytes() {
-    return lastValue.getValues();
-  }
-
-  @Override
-  public byte[] getSumValueBytes() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "sum"));
-  }
-
-  @Override
-  public ByteBuffer getMinValueBuffer() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "min"));
-  }
-
-  @Override
-  public ByteBuffer getMaxValueBuffer() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "max"));
-  }
-
-  @Override
-  public ByteBuffer getFirstValueBuffer() {
-    return ByteBuffer.wrap(firstValue.getValues());
-  }
-
-  @Override
-  public ByteBuffer getLastValueBuffer() {
-    return ByteBuffer.wrap(lastValue.getValues());
-  }
-
-  @Override
-  public ByteBuffer getSumValueBuffer() {
-    throw new StatisticsClassException(String.format(BINARY_STATS_UNSUPPORTED_MSG, "sum"));
-  }
-
-  @Override
   public int serializeStats(OutputStream outputStream) throws IOException {
     int byteLen = 0;
     byteLen += ReadWriteIOUtils.write(firstValue, outputStream);
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/BooleanStatistics.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/BooleanStatistics.java
index 05a46aa..56745c2 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/BooleanStatistics.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/BooleanStatistics.java
@@ -20,7 +20,6 @@ package org.apache.iotdb.tsfile.file.metadata.statistics;
 
 import org.apache.iotdb.tsfile.exception.filter.StatisticsClassException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.utils.BytesUtils;
 import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
 
 import java.io.IOException;
@@ -36,12 +35,17 @@ public class BooleanStatistics extends Statistics<Boolean> {
   private long sumValue;
 
   static final int BOOLEAN_STATISTICS_FIXED_RAM_SIZE = 56;
+  private static final String BOOLEAN = "Boolean";
 
   @Override
   public TSDataType getType() {
     return TSDataType.BOOLEAN;
   }
 
+  /**
+   * The output of this method should be identical to the method "serializeStats(OutputStream
+   * outputStream)"
+   */
   @Override
   public int getStatsSize() {
     return 10;
@@ -101,16 +105,13 @@ public class BooleanStatistics extends Statistics<Boolean> {
   }
 
   @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {}
-
-  @Override
   public Boolean getMinValue() {
-    throw new StatisticsClassException("Boolean statistics does not support: min");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, BOOLEAN, "min"));
   }
 
   @Override
   public Boolean getMaxValue() {
-    throw new StatisticsClassException("Boolean statistics does not support: max");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, BOOLEAN, "max"));
   }
 
   @Override
@@ -125,7 +126,7 @@ public class BooleanStatistics extends Statistics<Boolean> {
 
   @Override
   public double getSumDoubleValue() {
-    throw new StatisticsClassException("Boolean statistics does not support: double sum");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, BOOLEAN, "double sum"));
   }
 
   @Override
@@ -134,31 +135,6 @@ public class BooleanStatistics extends Statistics<Boolean> {
   }
 
   @Override
-  public ByteBuffer getMinValueBuffer() {
-    throw new StatisticsClassException("Boolean statistics do not support: min");
-  }
-
-  @Override
-  public ByteBuffer getMaxValueBuffer() {
-    throw new StatisticsClassException("Boolean statistics do not support: max");
-  }
-
-  @Override
-  public ByteBuffer getFirstValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(firstValue);
-  }
-
-  @Override
-  public ByteBuffer getLastValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(lastValue);
-  }
-
-  @Override
-  public ByteBuffer getSumValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(sumValue);
-  }
-
-  @Override
   protected void mergeStatisticsValue(Statistics<Boolean> stats) {
     BooleanStatistics boolStats = (BooleanStatistics) stats;
     if (isEmpty) {
@@ -175,31 +151,6 @@ public class BooleanStatistics extends Statistics<Boolean> {
   }
 
   @Override
-  public byte[] getMinValueBytes() {
-    throw new StatisticsClassException("Boolean statistics does not support: min");
-  }
-
-  @Override
-  public byte[] getMaxValueBytes() {
-    throw new StatisticsClassException("Boolean statistics does not support: max");
-  }
-
-  @Override
-  public byte[] getFirstValueBytes() {
-    return BytesUtils.boolToBytes(firstValue);
-  }
-
-  @Override
-  public byte[] getLastValueBytes() {
-    return BytesUtils.boolToBytes(lastValue);
-  }
-
-  @Override
-  public byte[] getSumValueBytes() {
-    return BytesUtils.longToBytes(sumValue);
-  }
-
-  @Override
   public int serializeStats(OutputStream outputStream) throws IOException {
     int byteLen = 0;
     byteLen += ReadWriteIOUtils.write(firstValue, outputStream);
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/DoubleStatistics.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/DoubleStatistics.java
index d8a5831..a867d3e 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/DoubleStatistics.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/DoubleStatistics.java
@@ -20,7 +20,6 @@ package org.apache.iotdb.tsfile.file.metadata.statistics;
 
 import org.apache.iotdb.tsfile.exception.filter.StatisticsClassException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.utils.BytesUtils;
 import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
 
 import java.io.IOException;
@@ -38,12 +37,17 @@ public class DoubleStatistics extends Statistics<Double> {
   private double sumValue;
 
   static final int DOUBLE_STATISTICS_FIXED_RAM_SIZE = 80;
+  private static final String DOUBLE = "Double";
 
   @Override
   public TSDataType getType() {
     return TSDataType.DOUBLE;
   }
 
+  /**
+   * The output of this method should be identical to the method "serializeStats(OutputStream
+   * outputStream)"
+   */
   @Override
   public int getStatsSize() {
     return 40;
@@ -104,12 +108,6 @@ public class DoubleStatistics extends Statistics<Double> {
   }
 
   @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    minValue = BytesUtils.bytesToDouble(minBytes);
-    maxValue = BytesUtils.bytesToDouble(maxBytes);
-  }
-
-  @Override
   void updateStats(double value) {
     if (this.isEmpty) {
       initializeStats(value, value, value, value, value);
@@ -158,7 +156,7 @@ public class DoubleStatistics extends Statistics<Double> {
 
   @Override
   public long getSumLongValue() {
-    throw new StatisticsClassException("Double statistics does not support: long sum");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, DOUBLE, "long sum"));
   }
 
   @Override
@@ -185,56 +183,6 @@ public class DoubleStatistics extends Statistics<Double> {
   }
 
   @Override
-  public byte[] getMinValueBytes() {
-    return BytesUtils.doubleToBytes(minValue);
-  }
-
-  @Override
-  public byte[] getMaxValueBytes() {
-    return BytesUtils.doubleToBytes(maxValue);
-  }
-
-  @Override
-  public byte[] getFirstValueBytes() {
-    return BytesUtils.doubleToBytes(firstValue);
-  }
-
-  @Override
-  public byte[] getLastValueBytes() {
-    return BytesUtils.doubleToBytes(lastValue);
-  }
-
-  @Override
-  public byte[] getSumValueBytes() {
-    return BytesUtils.doubleToBytes(sumValue);
-  }
-
-  @Override
-  public ByteBuffer getMinValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(minValue);
-  }
-
-  @Override
-  public ByteBuffer getMaxValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(maxValue);
-  }
-
-  @Override
-  public ByteBuffer getFirstValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(firstValue);
-  }
-
-  @Override
-  public ByteBuffer getLastValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(lastValue);
-  }
-
-  @Override
-  public ByteBuffer getSumValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(sumValue);
-  }
-
-  @Override
   public int serializeStats(OutputStream outputStream) throws IOException {
     int byteLen = 0;
     byteLen += ReadWriteIOUtils.write(minValue, outputStream);
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/FloatStatistics.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/FloatStatistics.java
index 3380d5d..612ce61 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/FloatStatistics.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/FloatStatistics.java
@@ -20,7 +20,6 @@ package org.apache.iotdb.tsfile.file.metadata.statistics;
 
 import org.apache.iotdb.tsfile.exception.filter.StatisticsClassException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.utils.BytesUtils;
 import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
 
 import java.io.IOException;
@@ -39,12 +38,17 @@ public class FloatStatistics extends Statistics<Float> {
   private double sumValue;
 
   static final int FLOAT_STATISTICS_FIXED_RAM_SIZE = 64;
+  private static final String FLOAT = "Float";
 
   @Override
   public TSDataType getType() {
     return TSDataType.FLOAT;
   }
 
+  /**
+   * The output of this method should be identical to the method "serializeStats(OutputStream
+   * outputStream)"
+   */
   @Override
   public int getStatsSize() {
     return 24;
@@ -96,12 +100,6 @@ public class FloatStatistics extends Statistics<Float> {
   }
 
   @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    minValue = BytesUtils.bytesToFloat(minBytes);
-    maxValue = BytesUtils.bytesToFloat(maxBytes);
-  }
-
-  @Override
   void updateStats(float value) {
     if (this.isEmpty) {
       initializeStats(value, value, value, value, value);
@@ -150,7 +148,7 @@ public class FloatStatistics extends Statistics<Float> {
 
   @Override
   public long getSumLongValue() {
-    throw new StatisticsClassException("Float statistics does not support: long sum");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, FLOAT, "long sum"));
   }
 
   @Override
@@ -177,56 +175,6 @@ public class FloatStatistics extends Statistics<Float> {
   }
 
   @Override
-  public byte[] getMinValueBytes() {
-    return BytesUtils.floatToBytes(minValue);
-  }
-
-  @Override
-  public byte[] getMaxValueBytes() {
-    return BytesUtils.floatToBytes(maxValue);
-  }
-
-  @Override
-  public byte[] getFirstValueBytes() {
-    return BytesUtils.floatToBytes(firstValue);
-  }
-
-  @Override
-  public byte[] getLastValueBytes() {
-    return BytesUtils.floatToBytes(lastValue);
-  }
-
-  @Override
-  public byte[] getSumValueBytes() {
-    return BytesUtils.doubleToBytes(sumValue);
-  }
-
-  @Override
-  public ByteBuffer getMinValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(minValue);
-  }
-
-  @Override
-  public ByteBuffer getMaxValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(maxValue);
-  }
-
-  @Override
-  public ByteBuffer getFirstValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(firstValue);
-  }
-
-  @Override
-  public ByteBuffer getLastValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(lastValue);
-  }
-
-  @Override
-  public ByteBuffer getSumValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(sumValue);
-  }
-
-  @Override
   public int serializeStats(OutputStream outputStream) throws IOException {
     int byteLen = 0;
     byteLen += ReadWriteIOUtils.write(minValue, outputStream);
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/IntegerStatistics.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/IntegerStatistics.java
index 3cc2dcd..26570f4 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/IntegerStatistics.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/IntegerStatistics.java
@@ -20,7 +20,6 @@ package org.apache.iotdb.tsfile.file.metadata.statistics;
 
 import org.apache.iotdb.tsfile.exception.filter.StatisticsClassException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.utils.BytesUtils;
 import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
 
 import java.io.IOException;
@@ -39,12 +38,17 @@ public class IntegerStatistics extends Statistics<Integer> {
   private long sumValue;
 
   static final int INTEGER_STATISTICS_FIXED_RAM_SIZE = 64;
+  private static final String INTEGER = "Integer";
 
   @Override
   public TSDataType getType() {
     return TSDataType.INT32;
   }
 
+  /**
+   * The output of this method should be identical to the method "serializeStats(OutputStream
+   * outputStream)"
+   */
   @Override
   public int getStatsSize() {
     return 24;
@@ -96,12 +100,6 @@ public class IntegerStatistics extends Statistics<Integer> {
   }
 
   @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    minValue = BytesUtils.bytesToInt(minBytes);
-    maxValue = BytesUtils.bytesToInt(maxBytes);
-  }
-
-  @Override
   void updateStats(int value) {
     if (isEmpty) {
       initializeStats(value, value, value, value, value);
@@ -145,7 +143,7 @@ public class IntegerStatistics extends Statistics<Integer> {
 
   @Override
   public double getSumDoubleValue() {
-    throw new StatisticsClassException("Integer statistics does not support: double sum");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, INTEGER, "double sum"));
   }
 
   @Override
@@ -177,56 +175,6 @@ public class IntegerStatistics extends Statistics<Integer> {
   }
 
   @Override
-  public ByteBuffer getMinValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(minValue);
-  }
-
-  @Override
-  public ByteBuffer getMaxValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(maxValue);
-  }
-
-  @Override
-  public ByteBuffer getFirstValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(firstValue);
-  }
-
-  @Override
-  public ByteBuffer getLastValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(lastValue);
-  }
-
-  @Override
-  public ByteBuffer getSumValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(sumValue);
-  }
-
-  @Override
-  public byte[] getMinValueBytes() {
-    return BytesUtils.intToBytes(minValue);
-  }
-
-  @Override
-  public byte[] getMaxValueBytes() {
-    return BytesUtils.intToBytes(maxValue);
-  }
-
-  @Override
-  public byte[] getFirstValueBytes() {
-    return BytesUtils.intToBytes(firstValue);
-  }
-
-  @Override
-  public byte[] getLastValueBytes() {
-    return BytesUtils.intToBytes(lastValue);
-  }
-
-  @Override
-  public byte[] getSumValueBytes() {
-    return BytesUtils.longToBytes(sumValue);
-  }
-
-  @Override
   public int serializeStats(OutputStream outputStream) throws IOException {
     int byteLen = 0;
     byteLen += ReadWriteIOUtils.write(minValue, outputStream);
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/LongStatistics.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/LongStatistics.java
index 80741c2..7326fab 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/LongStatistics.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/LongStatistics.java
@@ -20,7 +20,6 @@ package org.apache.iotdb.tsfile.file.metadata.statistics;
 
 import org.apache.iotdb.tsfile.exception.filter.StatisticsClassException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.utils.BytesUtils;
 import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
 
 import java.io.IOException;
@@ -38,12 +37,17 @@ public class LongStatistics extends Statistics<Long> {
   private double sumValue;
 
   static final int LONG_STATISTICS_FIXED_RAM_SIZE = 80;
+  private static final String LONG = "Long";
 
   @Override
   public TSDataType getType() {
     return TSDataType.INT64;
   }
 
+  /**
+   * The output of this method should be identical to the method "serializeStats(OutputStream
+   * outputStream)"
+   */
   @Override
   public int getStatsSize() {
     return 40;
@@ -95,12 +99,6 @@ public class LongStatistics extends Statistics<Long> {
   }
 
   @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    minValue = BytesUtils.bytesToLong(minBytes);
-    maxValue = BytesUtils.bytesToLong(maxBytes);
-  }
-
-  @Override
   public Long getMinValue() {
     return minValue;
   }
@@ -127,7 +125,7 @@ public class LongStatistics extends Statistics<Long> {
 
   @Override
   public long getSumLongValue() {
-    throw new StatisticsClassException("Long statistics does not support: long sum");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, LONG, "long sum"));
   }
 
   @Override
@@ -186,56 +184,6 @@ public class LongStatistics extends Statistics<Long> {
   }
 
   @Override
-  public byte[] getMinValueBytes() {
-    return BytesUtils.longToBytes(minValue);
-  }
-
-  @Override
-  public byte[] getMaxValueBytes() {
-    return BytesUtils.longToBytes(maxValue);
-  }
-
-  @Override
-  public byte[] getFirstValueBytes() {
-    return BytesUtils.longToBytes(firstValue);
-  }
-
-  @Override
-  public byte[] getLastValueBytes() {
-    return BytesUtils.longToBytes(lastValue);
-  }
-
-  @Override
-  public byte[] getSumValueBytes() {
-    return BytesUtils.doubleToBytes(sumValue);
-  }
-
-  @Override
-  public ByteBuffer getMinValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(minValue);
-  }
-
-  @Override
-  public ByteBuffer getMaxValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(maxValue);
-  }
-
-  @Override
-  public ByteBuffer getFirstValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(firstValue);
-  }
-
-  @Override
-  public ByteBuffer getLastValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(lastValue);
-  }
-
-  @Override
-  public ByteBuffer getSumValueBuffer() {
-    return ReadWriteIOUtils.getByteBuffer(sumValue);
-  }
-
-  @Override
   public int serializeStats(OutputStream outputStream) throws IOException {
     int byteLen = 0;
     byteLen += ReadWriteIOUtils.write(minValue, outputStream);
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/Statistics.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/Statistics.java
index abec0e7..a9fcec1 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/Statistics.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/Statistics.java
@@ -58,6 +58,8 @@ public abstract class Statistics<T extends Serializable> {
   private long startTime = Long.MAX_VALUE;
   private long endTime = Long.MIN_VALUE;
 
+  static final String STATS_UNSUPPORTED_MSG = "%s statistics does not support: %s";
+
   /**
    * static method providing statistic instance for respective data type.
    *
@@ -133,8 +135,6 @@ public abstract class Statistics<T extends Serializable> {
 
   public abstract void deserialize(ByteBuffer byteBuffer);
 
-  public abstract void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes);
-
   public abstract T getMinValue();
 
   public abstract T getMaxValue();
@@ -147,26 +147,6 @@ public abstract class Statistics<T extends Serializable> {
 
   public abstract long getSumLongValue();
 
-  public abstract byte[] getMinValueBytes();
-
-  public abstract byte[] getMaxValueBytes();
-
-  public abstract byte[] getFirstValueBytes();
-
-  public abstract byte[] getLastValueBytes();
-
-  public abstract byte[] getSumValueBytes();
-
-  public abstract ByteBuffer getMinValueBuffer();
-
-  public abstract ByteBuffer getMaxValueBuffer();
-
-  public abstract ByteBuffer getFirstValueBuffer();
-
-  public abstract ByteBuffer getLastValueBuffer();
-
-  public abstract ByteBuffer getSumValueBuffer();
-
   /**
    * merge parameter to this statistic
    *
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/TimeStatistics.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/TimeStatistics.java
index 8ed2778..adc967e 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/TimeStatistics.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/TimeStatistics.java
@@ -29,65 +29,65 @@ import java.nio.ByteBuffer;
 public class TimeStatistics extends Statistics<Long> {
 
   static final int TIME_STATISTICS_FIXED_RAM_SIZE = 40;
+  private static final String TIME = "Time";
 
   @Override
   public TSDataType getType() {
     return TSDataType.VECTOR;
   }
 
+  /**
+   * The output of this method should be identical to the method "serializeStats(OutputStream
+   * outputStream)"
+   */
   @Override
   public int getStatsSize() {
     return 0;
   }
 
   @Override
-  public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
-    throw new StatisticsClassException("Time statistics does not support: set min max from bytes");
-  }
-
-  @Override
   public Long getMinValue() {
-    throw new StatisticsClassException("Time statistics does not support: min value");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, TIME, "min value"));
   }
 
   @Override
   public Long getMaxValue() {
-    throw new StatisticsClassException("Time statistics does not support: max value");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, TIME, "max value"));
   }
 
   @Override
   public Long getFirstValue() {
-    throw new StatisticsClassException("Time statistics does not support: first value");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, TIME, "first value"));
   }
 
   @Override
   public Long getLastValue() {
-    throw new StatisticsClassException("Time statistics does not support: last value");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, TIME, "last value"));
   }
 
   @Override
   public double getSumDoubleValue() {
-    throw new StatisticsClassException("Time statistics does not support: double sum");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, TIME, "double sum"));
   }
 
   @Override
   public long getSumLongValue() {
-    throw new StatisticsClassException("Time statistics does not support: long sum");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, TIME, "long sum"));
   }
 
   @Override
   void updateStats(long value) {
-    throw new StatisticsClassException("Time statistics does not support: update stats");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, TIME, "update stats"));
   }
 
   @Override
   void updateStats(long[] values, int batchSize) {
-    throw new StatisticsClassException("Time statistics does not support: update stats");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, TIME, "update stats"));
   }
 
   @Override
   public void updateStats(long minValue, long maxValue) {
-    throw new StatisticsClassException("Time statistics does not support: update stats");
+    throw new StatisticsClassException(String.format(STATS_UNSUPPORTED_MSG, TIME, "update stats"));
   }
 
   @Override
@@ -99,56 +99,6 @@ public class TimeStatistics extends Statistics<Long> {
   protected void mergeStatisticsValue(Statistics<Long> stats) {}
 
   @Override
-  public byte[] getMinValueBytes() {
-    throw new StatisticsClassException("Time statistics does not support: get min value bytes");
-  }
-
-  @Override
-  public byte[] getMaxValueBytes() {
-    throw new StatisticsClassException("Time statistics does not support: get max value bytes");
-  }
-
-  @Override
-  public byte[] getFirstValueBytes() {
-    throw new StatisticsClassException("Time statistics does not support: get first value bytes");
-  }
-
-  @Override
-  public byte[] getLastValueBytes() {
-    throw new StatisticsClassException("Time statistics does not support: get last value bytes");
-  }
-
-  @Override
-  public byte[] getSumValueBytes() {
-    throw new StatisticsClassException("Time statistics does not support: get sum value bytes");
-  }
-
-  @Override
-  public ByteBuffer getMinValueBuffer() {
-    throw new StatisticsClassException("Time statistics does not support: get min value bytes");
-  }
-
-  @Override
-  public ByteBuffer getMaxValueBuffer() {
-    throw new StatisticsClassException("Time statistics does not support: get max value buffer");
-  }
-
-  @Override
-  public ByteBuffer getFirstValueBuffer() {
-    throw new StatisticsClassException("Time statistics does not support: get first value buffer");
-  }
-
-  @Override
-  public ByteBuffer getLastValueBuffer() {
-    throw new StatisticsClassException("Time statistics does not support: get last value buffer");
-  }
-
-  @Override
-  public ByteBuffer getSumValueBuffer() {
-    throw new StatisticsClassException("Time statistics does not support: get sum value buffer");
-  }
-
-  @Override
   public int serializeStats(OutputStream outputStream) {
     return 0;
   }