You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2025/07/03 04:30:47 UTC

(iotdb) 01/03: refactor compression

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

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

commit e59dd30b6099c4e2e49d32e6de6a5faf79471836
Author: Tian Jiang <jt...@163.com>
AuthorDate: Tue Jul 1 19:00:40 2025 +0800

    refactor compression
---
 .../java/org/apache/iotdb/session/Session.java     |  39 ++--
 .../iotdb/session/rpccompress/ColumnEntry.java     | 144 --------------
 .../apache/iotdb/session/rpccompress/MetaHead.java | 140 -------------
 .../iotdb/session/rpccompress/RpcCompressor.java   |  79 --------
 .../iotdb/session/rpccompress/RpcUncompressor.java |  73 -------
 .../iotdb/session/rpccompress/TabletEncoder.java   | 115 +++++++++++
 .../rpccompress/decoder/ChimpColumnDecoder.java    | 103 ----------
 .../session/rpccompress/decoder/ColumnDecoder.java |  49 -----
 .../decoder/DictionaryColumnDecoder.java           |  78 --------
 .../rpccompress/decoder/GorillaColumnDecoder.java  | 103 ----------
 .../rpccompress/decoder/PlainColumnDecoder.java    | 152 ---------------
 .../rpccompress/decoder/RlbeColumnDecoder.java     | 104 ----------
 .../rpccompress/decoder/RleColumnDecoder.java      | 112 -----------
 .../session/rpccompress/decoder/RpcDecoder.java    | 125 ------------
 .../rpccompress/decoder/SprintzColumnDecoder.java  | 104 ----------
 .../rpccompress/decoder/Ts2DiffColumnDecoder.java  |  98 ----------
 .../rpccompress/decoder/ZigzagColumnDecoder.java   |  95 ---------
 .../rpccompress/encoder/ChimpColumnEncoder.java    | 168 ----------------
 .../session/rpccompress/encoder/ColumnEncoder.java |  94 ---------
 .../encoder/DictionaryColumnEncoder.java           | 111 -----------
 .../rpccompress/encoder/GorillaColumnEncoder.java  | 164 ----------------
 .../rpccompress/encoder/PlainColumnEncoder.java    | 217 ---------------------
 .../rpccompress/encoder/RlbeColumnEncoder.java     | 164 ----------------
 .../rpccompress/encoder/RleColumnEncoder.java      | 182 -----------------
 .../session/rpccompress/encoder/RpcEncoder.java    | 203 -------------------
 .../rpccompress/encoder/SprintzColumnEncoder.java  | 164 ----------------
 .../rpccompress/encoder/Ts2DiffColumnEncoder.java  | 148 --------------
 .../rpccompress/encoder/ZigzagColumnEncoder.java   | 127 ------------
 .../payload/SubscriptionSessionDataSet.java        |   1 -
 .../apache/iotdb/session/util/SessionUtils.java    | 125 ++++++++++++
 .../iotdb/session/SessionCacheLeaderTest.java      |   2 +-
 .../plan/parser/StatementGenerator.java            | 140 +++----------
 .../java/org/apache/iotdb/util/TabletDecoder.java  | 197 +++++++++++++++++++
 .../schema/table/column/TsTableColumnCategory.java |   2 +-
 .../thrift-datanode/src/main/thrift/client.thrift  |   4 +-
 35 files changed, 493 insertions(+), 3433 deletions(-)

diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
index a127c55b3ae..300c80af7ee 100644
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
+++ b/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
@@ -56,8 +56,7 @@ import org.apache.iotdb.service.rpc.thrift.TSQueryTemplateReq;
 import org.apache.iotdb.service.rpc.thrift.TSQueryTemplateResp;
 import org.apache.iotdb.service.rpc.thrift.TSSetSchemaTemplateReq;
 import org.apache.iotdb.service.rpc.thrift.TSUnsetSchemaTemplateReq;
-import org.apache.iotdb.session.rpccompress.RpcCompressor;
-import org.apache.iotdb.session.rpccompress.encoder.RpcEncoder;
+import org.apache.iotdb.session.rpccompress.TabletEncoder;
 import org.apache.iotdb.session.template.MeasurementNode;
 import org.apache.iotdb.session.template.TemplateQueryType;
 import org.apache.iotdb.session.util.SessionUtils;
@@ -2980,28 +2979,34 @@ public class Session implements ISession {
     request.setPrefixPath(tablet.getDeviceId());
     request.setIsAligned(isAligned);
 
-    if (this.enableRPCCompression) {
-      request.setIsCompressed(true);
+    List<Byte> encodingTypes;
+    if (enableRPCCompression) {
+      encodingTypes = new ArrayList<>(tablet.getSchemas().size() + 1);
+      encodingTypes.add(this.columnEncodersMap.get(TSDataType.INT64).serialize());
       for (IMeasurementSchema measurementSchema : tablet.getSchemas()) {
         if (measurementSchema.getMeasurementName() == null) {
           throw new IllegalArgumentException("measurement should be non null value");
         }
-        request.addToEncodingTypes(
-            this.columnEncodersMap.get(measurementSchema.getType()).ordinal());
-      }
-      final long startTime = System.nanoTime();
-      try {
-        RpcEncoder rpcEncoder = new RpcEncoder(this.columnEncodersMap);
-        RpcCompressor rpcCompressor = new RpcCompressor(this.compressionType);
-        request.setCompressType(this.compressionType.serialize());
-        request.setTimestamps(rpcCompressor.compress(rpcEncoder.encodeTimestamps(tablet)));
-        request.setValues(rpcCompressor.compress(rpcEncoder.encodeValues(tablet)));
-      } finally {
+        encodingTypes.add(this.columnEncodersMap.get(measurementSchema.getType()).serialize());
       }
     } else {
-      request.setTimestamps(SessionUtils.getTimeBuffer(tablet));
-      request.setValues(SessionUtils.getValueBuffer(tablet));
+      encodingTypes =
+          Collections.nCopies(tablet.getSchemas().size() + 1, TSEncoding.PLAIN.serialize());
+    }
+
+    TabletEncoder encoder =
+        new TabletEncoder(
+            this.compressionType,
+            encodingTypes.stream().map(TSEncoding::deserialize).collect(Collectors.toList()));
+
+    request.setIsCompressed(this.enableRPCCompression);
+    if (this.enableRPCCompression) {
+      request.setCompressType(compressionType.serialize());
+      request.setEncodingTypes(encodingTypes);
     }
+    request.setTimestamps(encoder.encodeTime(tablet));
+    request.setValues(encoder.encodeValues(tablet));
+
     request.setSize(tablet.getRowSize());
     return request;
   }
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/ColumnEntry.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/ColumnEntry.java
deleted file mode 100644
index c3824f53303..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/ColumnEntry.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress;
-
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-
-import java.io.Serializable;
-import java.nio.ByteBuffer;
-
-public class ColumnEntry implements Serializable {
-
-  private Integer compressedSize;
-  private Integer unCompressedSize;
-  private TSDataType dataType;
-  private TSEncoding encodingType;
-
-  /** The number of bytes occupied by ColumnEntry */
-  private Integer size;
-
-  public ColumnEntry() {
-    updateSize();
-  }
-
-  public ColumnEntry(
-      Integer compressedSize,
-      Integer unCompressedSize,
-      TSDataType dataType,
-      TSEncoding encodingType) {
-    this.compressedSize = compressedSize;
-    this.unCompressedSize = unCompressedSize;
-    this.dataType = dataType;
-    this.encodingType = encodingType;
-    updateSize();
-  }
-
-  /**
-   * Update the total size of the column entry Total size = compressedSize (4 bytes) +
-   * unCompressedSize (4 bytes) + dataType (1 byte) + encodingType (1 byte) + offset (4 bytes)
-   */
-  public void updateSize() {
-    int totalSize = 0;
-    totalSize += 4;
-    totalSize += 4;
-    totalSize += 1;
-    totalSize += 1;
-    this.size = totalSize;
-  }
-
-  public Integer getCompressedSize() {
-    return compressedSize;
-  }
-
-  public Integer getUnCompressedSize() {
-    return unCompressedSize;
-  }
-
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  public TSEncoding getEncodingType() {
-    return encodingType;
-  }
-
-  public Integer getSize() {
-    return size;
-  }
-
-  public void setCompressedSize(Integer compressedSize) {
-    this.compressedSize = compressedSize;
-  }
-
-  public void setUnCompressedSize(Integer unCompressedSize) {
-    this.unCompressedSize = unCompressedSize;
-  }
-
-  public void setDataType(TSDataType dataType) {
-    this.dataType = dataType;
-  }
-
-  public void setEncodingType(TSEncoding encodingType) {
-    this.encodingType = encodingType;
-  }
-
-  public void setSize(Integer size) {
-    this.size = size;
-  }
-
-  @Override
-  public String toString() {
-    return "ColumnEntry{"
-        + "compressedSize="
-        + compressedSize
-        + ", unCompressedSize="
-        + unCompressedSize
-        + ", dataType="
-        + dataType
-        + ", encodingType="
-        + encodingType
-        + ", size="
-        + size
-        + '}';
-  }
-
-  public byte[] toBytes() {
-    ByteBuffer buffer = ByteBuffer.allocate(getSize());
-    buffer.putInt(compressedSize != null ? compressedSize : 0);
-    buffer.putInt(unCompressedSize != null ? unCompressedSize : 0);
-    buffer.put((byte) (dataType != null ? dataType.ordinal() : 0));
-    buffer.put((byte) (encodingType != null ? encodingType.ordinal() : 0));
-    return buffer.array();
-  }
-
-  public static ColumnEntry fromBytes(ByteBuffer buffer) {
-    int compressedSize = buffer.getInt();
-    int unCompressedSize = buffer.getInt();
-    TSDataType dataType = TSDataType.values()[buffer.get()];
-    TSEncoding encodingType = TSEncoding.values()[buffer.get()];
-    ColumnEntry entry = new ColumnEntry();
-    entry.setCompressedSize(compressedSize);
-    entry.setUnCompressedSize(unCompressedSize);
-    entry.setDataType(dataType);
-    entry.setEncodingType(encodingType);
-    entry.updateSize();
-    return entry;
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/MetaHead.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/MetaHead.java
deleted file mode 100644
index c66ff9afe21..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/MetaHead.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress;
-
-import java.io.Serializable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MetaHead implements Serializable {
-
-  /** Number of columns in the compressed file. */
-  private Integer numberOfColumns;
-
-  /** The size of the metadata header. */
-  private Integer size;
-
-  /** ColumnEntry list */
-  private List<ColumnEntry> columnEntries;
-
-  public MetaHead() {
-    this.columnEntries = new ArrayList<>();
-    updateSize();
-  }
-
-  public MetaHead(Integer numberOfColumns, List<ColumnEntry> columnEntries) {
-    this.numberOfColumns = numberOfColumns;
-    this.columnEntries = columnEntries;
-    updateSize();
-  }
-
-  public Integer getNumberOfColumns() {
-    return numberOfColumns;
-  }
-
-  public Integer getSize() {
-    return size;
-  }
-
-  public List<ColumnEntry> getColumnEntries() {
-    return columnEntries;
-  }
-
-  /**
-   * Append ColumnEntry
-   *
-   * @param entry ColumnEntry
-   */
-  public void addColumnEntry(ColumnEntry entry) {
-    if (columnEntries == null) {
-      columnEntries = new ArrayList<>();
-    }
-    columnEntries.add(entry);
-    numberOfColumns = columnEntries.size();
-    updateSize();
-  }
-
-  /**
-   * Update the size of the metadata header. The total size of MetaHead = MetaHead header size + the
-   * size of all ColumnEntry. MetaHead header size = numberOfColumns (4 bytes) + size (4 bytes).
-   */
-  private void updateSize() {
-    // MetaHead header size, numberOfColumns(4 byte) + size(4 byte)
-    int totalSize = 8;
-
-    // Accumulate the size of all ColumnEntry
-    if (columnEntries != null) {
-      for (ColumnEntry entry : columnEntries) {
-        if (entry != null && entry.getSize() != null) {
-          totalSize += entry.getSize();
-        }
-      }
-    }
-    this.size = totalSize;
-  }
-
-  /** Serialize to byte array */
-  public byte[] toBytes() {
-    // 1. Calculate total length
-    int totalSize = 8; // numberOfColumns(4字节) + size(4字节)
-    for (ColumnEntry entry : columnEntries) {
-      totalSize += entry.getSize();
-    }
-    ByteBuffer buffer = ByteBuffer.allocate(totalSize);
-
-    // 2. Write numberOfColumns and size
-    buffer.putInt(numberOfColumns != null ? numberOfColumns : 0);
-    buffer.putInt(size != null ? size : 0);
-
-    // 3. Write each ColumnEntry
-    for (ColumnEntry entry : columnEntries) {
-      buffer.put(entry.toBytes());
-    }
-
-    return buffer.array();
-  }
-
-  /** Deserialize from byte array */
-  public static MetaHead fromBytes(byte[] bytes) {
-    ByteBuffer buffer = ByteBuffer.wrap(bytes);
-    int numberOfColumns = buffer.getInt();
-    int size = buffer.getInt();
-    List<ColumnEntry> columnEntries = new ArrayList<>();
-    for (int i = 0; i < numberOfColumns; i++) {
-      ColumnEntry entry = ColumnEntry.fromBytes(buffer);
-      columnEntries.add(entry);
-    }
-    MetaHead metaHead = new MetaHead(numberOfColumns, columnEntries);
-    metaHead.size = size;
-    return metaHead;
-  }
-
-  @Override
-  public String toString() {
-    return "MetaHead{"
-        + "numberOfColumns="
-        + numberOfColumns
-        + ", size="
-        + size
-        + ", columnEntries="
-        + columnEntries
-        + '}';
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/RpcCompressor.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/RpcCompressor.java
deleted file mode 100644
index 356a2cb84a5..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/RpcCompressor.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress;
-
-import org.apache.tsfile.compress.ICompressor;
-import org.apache.tsfile.file.metadata.enums.CompressionType;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class RpcCompressor {
-
-  public static ICompressor compressor;
-
-  public RpcCompressor(CompressionType name) {
-    compressor = ICompressor.getCompressor(name);
-  }
-
-  public ByteBuffer compress(ByteArrayOutputStream input) {
-    try {
-      byte[] data = input.toByteArray();
-      int length = data.length;
-
-      byte[] compressed = compress(data);
-      ByteBuffer buffer = ByteBuffer.allocate(compressed.length + Integer.BYTES);
-      buffer.put(compressed).putInt(length);
-      buffer.flip();
-      return buffer;
-    } catch (IOException e) {
-      throw new RuntimeException("Compression failed", e);
-    }
-  }
-
-  public byte[] compress(byte[] data) throws IOException {
-    return compressor.compress(data);
-  }
-
-  public byte[] compress(byte[] data, int offset, int length) throws IOException {
-    return compressor.compress(data, offset, length);
-  }
-
-  public int compress(byte[] data, int offset, int length, byte[] compressed) throws IOException {
-    return compressor.compress(data, offset, length, compressed);
-  }
-
-  /**
-   * Compress ByteBuffer, this method is better for longer data
-   *
-   * @return byte length of compressed data.
-   */
-  public int compress(ByteBuffer data, ByteBuffer compressed) throws IOException {
-    return compressor.compress(data, compressed);
-  }
-
-  public int getMaxBytesForCompression(int uncompressedDataSize) {
-    return compressor.getMaxBytesForCompression(uncompressedDataSize);
-  }
-
-  public CompressionType getType() {
-    return compressor.getType();
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/RpcUncompressor.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/RpcUncompressor.java
deleted file mode 100644
index e38cf6c27f9..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/RpcUncompressor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress;
-
-import org.apache.tsfile.compress.IUnCompressor;
-import org.apache.tsfile.file.metadata.enums.CompressionType;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class RpcUncompressor {
-  public static IUnCompressor unCompressor;
-
-  public RpcUncompressor(CompressionType name) {
-    unCompressor = IUnCompressor.getUnCompressor(name);
-  }
-
-  public ByteBuffer uncompress(ByteBuffer byteArray) {
-    try {
-      int uncompressedLength = byteArray.getInt(byteArray.limit() - 4);
-      ByteBuffer output = ByteBuffer.allocate(uncompressedLength);
-      byte[] compressedData = new byte[byteArray.remaining() - 4];
-      byteArray.slice().get(compressedData);
-      byte[] uncompressedData = unCompressor.uncompress(compressedData);
-      output.put(uncompressedData);
-      output.flip();
-      return output;
-    } catch (IOException e) {
-      throw new RuntimeException("Failed to decompress buffer", e);
-    }
-  }
-
-  public int getUncompressedLength(byte[] array, int offset, int length) throws IOException {
-    return unCompressor.getUncompressedLength(array, offset, length);
-  }
-
-  public int getUncompressedLength(ByteBuffer buffer) throws IOException {
-    return unCompressor.getUncompressedLength(buffer);
-  }
-
-  public byte[] uncompress(byte[] byteArray) throws IOException {
-    return unCompressor.uncompress(byteArray);
-  }
-
-  public int uncompress(byte[] byteArray, int offset, int length, byte[] output, int outOffset)
-      throws IOException {
-    return unCompressor.uncompress(byteArray, offset, length, output, outOffset);
-  }
-
-  public int uncompress(ByteBuffer compressed, ByteBuffer uncompressed) throws IOException {
-    return unCompressor.uncompress(compressed, uncompressed);
-  }
-
-  public CompressionType getCodecName() {
-    return unCompressor.getCodecName();
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/TabletEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/TabletEncoder.java
new file mode 100644
index 00000000000..3c8a97416e4
--- /dev/null
+++ b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/TabletEncoder.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.session.rpccompress;
+
+import org.apache.iotdb.session.util.SessionUtils;
+
+import org.apache.tsfile.compress.ICompressor;
+import org.apache.tsfile.encoding.encoder.Encoder;
+import org.apache.tsfile.encoding.encoder.TSEncodingBuilder;
+import org.apache.tsfile.enums.TSDataType;
+import org.apache.tsfile.file.metadata.enums.CompressionType;
+import org.apache.tsfile.file.metadata.enums.TSEncoding;
+import org.apache.tsfile.utils.BitMap;
+import org.apache.tsfile.utils.BytesUtils;
+import org.apache.tsfile.utils.PublicBAOS;
+import org.apache.tsfile.write.record.Tablet;
+import org.apache.tsfile.write.schema.IMeasurementSchema;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public class TabletEncoder {
+  private final CompressionType compressionType;
+  private final List<TSEncoding> encodingList;
+
+  /**
+   * @param compressionType compression type
+   * @param encodingList the first element is for the time column
+   */
+  public TabletEncoder(CompressionType compressionType, List<TSEncoding> encodingList) {
+    this.compressionType = compressionType;
+    this.encodingList = encodingList;
+  }
+
+  public ByteBuffer encodeTime(Tablet tablet) {
+    Encoder encoder =
+        TSEncodingBuilder.getEncodingBuilder(encodingList.get(0)).getEncoder(TSDataType.INT64);
+    PublicBAOS baos = new PublicBAOS();
+    for (int i = 0; i < tablet.getRowSize(); i++) {
+      encoder.encode(tablet.getTimestamp(i), baos);
+    }
+    try {
+      encoder.flush(baos);
+    } catch (IOException e) {
+      throw new IllegalStateException(e);
+    }
+    ByteBuffer buffer = ByteBuffer.wrap(baos.getBuf(), 0, baos.size());
+    return compressBuffer(buffer);
+  }
+
+  public ByteBuffer encodeValues(Tablet tablet) {
+    PublicBAOS baos = new PublicBAOS();
+    List<IMeasurementSchema> schemas = tablet.getSchemas();
+    for (int j = 0, schemasSize = schemas.size(); j < schemasSize; j++) {
+      IMeasurementSchema schema = schemas.get(j);
+      TSDataType dataType = schema.getType();
+      TSEncoding encoding = encodingList.get(j + 1);
+      Encoder encoder = TSEncodingBuilder.getEncodingBuilder(encoding).getEncoder(dataType);
+      SessionUtils.encodeValue(dataType, tablet, j, encoder, baos);
+    }
+
+    BitMap[] bitMaps = tablet.getBitMaps();
+    if (bitMaps != null) {
+      try (DataOutputStream dataOutputStream = new DataOutputStream(baos)) {
+        for (BitMap bitMap : bitMaps) {
+          boolean columnHasNull = bitMap != null && !bitMap.isAllUnmarked(tablet.getRowSize());
+          dataOutputStream.writeByte(BytesUtils.boolToByte(columnHasNull));
+          if (columnHasNull) {
+            dataOutputStream.write(bitMap.getTruncatedByteArray(tablet.getRowSize()));
+          }
+        }
+      } catch (IOException e) {
+        throw new IllegalStateException(e);
+      }
+    }
+
+    ByteBuffer buffer = ByteBuffer.wrap(baos.getBuf(), 0, baos.size());
+    return compressBuffer(buffer);
+  }
+
+  private ByteBuffer compressBuffer(ByteBuffer buffer) {
+    if (compressionType != CompressionType.UNCOMPRESSED) {
+      ICompressor compressor = ICompressor.getCompressor(compressionType);
+      ByteBuffer compressed =
+          ByteBuffer.allocate(compressor.getMaxBytesForCompression(buffer.remaining()));
+      try {
+        compressor.compress(buffer, compressed);
+        buffer = compressed;
+        buffer.flip();
+      } catch (IOException e) {
+        throw new IllegalStateException(e);
+      }
+    }
+    return buffer;
+  }
+}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ChimpColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ChimpColumnDecoder.java
deleted file mode 100644
index e2720a37dd6..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ChimpColumnDecoder.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.nio.ByteBuffer;
-
-public class ChimpColumnDecoder implements ColumnDecoder {
-  private final Decoder decoder;
-  private final TSDataType dataType;
-
-  public ChimpColumnDecoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.decoder = getDecoder(dataType, TSEncoding.CHIMP);
-  }
-
-  @Override
-  public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    switch (dataType) {
-      case FLOAT:
-        return decodeFloatColumn(buffer, columnEntry, rowCount);
-      case DOUBLE:
-        return decodeDoubleColumn(buffer, columnEntry, rowCount);
-      case INT32:
-      case DATE:
-        return decodeIntColumn(buffer, columnEntry, rowCount);
-      case INT64:
-      case TIMESTAMP:
-        return decodeLongColumn(buffer, columnEntry, rowCount);
-      default:
-        throw new UnSupportedDataTypeException("CHIMP doesn't support data type: " + dataType);
-    }
-  }
-
-  @Override
-  public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("CHIMP doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    int[] result = new int[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readInt(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    long[] result = new long[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readLong(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    float[] result = new float[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readFloat(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    double[] result = new double[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readDouble(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("CHIMP doesn't support data type: " + dataType);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ColumnDecoder.java
deleted file mode 100644
index aaae5e2e173..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ColumnDecoder.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-
-import java.nio.ByteBuffer;
-
-public interface ColumnDecoder {
-
-  Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount);
-
-  boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount);
-
-  int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount);
-
-  long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount);
-
-  float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount);
-
-  double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount);
-
-  Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount);
-
-  default Decoder getDecoder(TSDataType type, TSEncoding encodingType) {
-    return Decoder.getDecoderByType(encodingType, type);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/DictionaryColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/DictionaryColumnDecoder.java
deleted file mode 100644
index 098540817af..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/DictionaryColumnDecoder.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.nio.ByteBuffer;
-
-public class DictionaryColumnDecoder implements ColumnDecoder {
-  private final Decoder decoder;
-  private final TSDataType dataType;
-
-  public DictionaryColumnDecoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.decoder = getDecoder(dataType, TSEncoding.DICTIONARY);
-  }
-
-  @Override
-  public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    return decodeBinaryColumn(buffer, columnEntry, rowCount);
-  }
-
-  @Override
-  public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    Binary[] result = new Binary[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readBinary(buffer);
-    }
-    return result;
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/GorillaColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/GorillaColumnDecoder.java
deleted file mode 100644
index 877d4f0fe87..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/GorillaColumnDecoder.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-
-import java.nio.ByteBuffer;
-
-public class GorillaColumnDecoder implements ColumnDecoder {
-  private final Decoder decoder;
-  private final TSDataType dataType;
-
-  public GorillaColumnDecoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.decoder = getDecoder(dataType, TSEncoding.GORILLA);
-  }
-
-  @Override
-  public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    switch (dataType) {
-      case FLOAT:
-        return decodeFloatColumn(buffer, columnEntry, rowCount);
-      case DOUBLE:
-        return decodeDoubleColumn(buffer, columnEntry, rowCount);
-      case INT32:
-      case DATE:
-        return decodeIntColumn(buffer, columnEntry, rowCount);
-      case INT64:
-      case VECTOR:
-      case TIMESTAMP:
-        return decodeLongColumn(buffer, columnEntry, rowCount);
-      default:
-        throw new UnsupportedOperationException("Gorilla doesn't support data type: " + dataType);
-    }
-  }
-
-  @Override
-  public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnsupportedOperationException("Gorilla doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    int[] result = new int[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readInt(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    long[] result = new long[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readLong(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    float[] result = new float[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readFloat(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    double[] result = new double[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readDouble(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnsupportedOperationException("Gorilla doesn't support data type: " + dataType);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/PlainColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/PlainColumnDecoder.java
deleted file mode 100644
index 941638cb83a..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/PlainColumnDecoder.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-
-import java.nio.ByteBuffer;
-
-public class PlainColumnDecoder implements ColumnDecoder {
-  private final Decoder decoder;
-  private final TSDataType dataType;
-
-  public PlainColumnDecoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.decoder = getDecoder(dataType, TSEncoding.PLAIN);
-  }
-
-  @Override
-  public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    switch (dataType) {
-      case BOOLEAN:
-        {
-          boolean[] result = new boolean[rowCount];
-          for (int i = 0; i < rowCount; i++) {
-            result[i] = decoder.readBoolean(buffer);
-          }
-          return result;
-        }
-      case INT32:
-      case DATE:
-        {
-          int[] result = new int[rowCount];
-          for (int i = 0; i < rowCount; i++) {
-            result[i] = decoder.readInt(buffer);
-          }
-          return result;
-        }
-      case INT64:
-      case TIMESTAMP:
-        {
-          long[] result = new long[rowCount];
-          for (int i = 0; i < rowCount; i++) {
-            result[i] = decoder.readLong(buffer);
-          }
-          return result;
-        }
-      case FLOAT:
-        {
-          float[] result = new float[rowCount];
-          for (int i = 0; i < rowCount; i++) {
-            result[i] = decoder.readFloat(buffer);
-          }
-          return result;
-        }
-      case DOUBLE:
-        {
-          double[] result = new double[rowCount];
-          for (int i = 0; i < rowCount; i++) {
-            result[i] = decoder.readDouble(buffer);
-          }
-          return result;
-        }
-      case TEXT:
-      case STRING:
-      case BLOB:
-        {
-          Binary[] result = new Binary[rowCount];
-          for (int i = 0; i < rowCount; i++) {
-            result[i] = decoder.readBinary(buffer);
-          }
-          return result;
-        }
-      default:
-        throw new UnsupportedOperationException("PLAIN doesn't support data type: " + dataType);
-    }
-  }
-
-  @Override
-  public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    boolean[] result = new boolean[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readBoolean(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    int[] result = new int[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readInt(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    long[] result = new long[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readLong(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    float[] result = new float[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readFloat(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    double[] result = new double[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readDouble(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    Binary[] result = new Binary[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readBinary(buffer);
-    }
-    return result;
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RlbeColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RlbeColumnDecoder.java
deleted file mode 100644
index cb89d478a00..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RlbeColumnDecoder.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.exception.encoding.TsFileDecodingException;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-
-import java.nio.ByteBuffer;
-
-public class RlbeColumnDecoder implements ColumnDecoder {
-  private final Decoder decoder;
-  private final TSDataType dataType;
-
-  public RlbeColumnDecoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.decoder = getDecoder(dataType, TSEncoding.RLBE);
-  }
-
-  @Override
-  public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    switch (dataType) {
-      case INT32:
-      case DATE:
-        return decodeIntColumn(buffer, columnEntry, rowCount);
-      case INT64:
-      case TIMESTAMP:
-        return decodeLongColumn(buffer, columnEntry, rowCount);
-      case FLOAT:
-        return decodeFloatColumn(buffer, columnEntry, rowCount);
-      case DOUBLE:
-        return decodeDoubleColumn(buffer, columnEntry, rowCount);
-      default:
-        throw new TsFileDecodingException(
-            String.format("RLBE doesn't support data type: " + dataType));
-    }
-  }
-
-  @Override
-  public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new TsFileDecodingException(String.format("RLBE doesn't support data type: " + dataType));
-  }
-
-  @Override
-  public int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    int[] result = new int[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readInt(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    long[] result = new long[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readLong(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    float[] result = new float[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readFloat(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    double[] result = new double[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readDouble(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new TsFileDecodingException(String.format("RLBE doesn't support data type: " + dataType));
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RleColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RleColumnDecoder.java
deleted file mode 100644
index bbaa5cb3c73..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RleColumnDecoder.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.nio.ByteBuffer;
-
-public class RleColumnDecoder implements ColumnDecoder {
-  private final Decoder decoder;
-  private final TSDataType dataType;
-
-  public RleColumnDecoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.decoder = getDecoder(dataType, TSEncoding.RLE);
-  }
-
-  @Override
-  public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    switch (dataType) {
-      case BOOLEAN:
-        return decodeBooleanColumn(buffer, columnEntry, rowCount);
-      case INT32:
-      case DATE:
-        return decodeIntColumn(buffer, columnEntry, rowCount);
-      case INT64:
-      case TIMESTAMP:
-        return decodeLongColumn(buffer, columnEntry, rowCount);
-      case FLOAT:
-        return decodeFloatColumn(buffer, columnEntry, rowCount);
-      case DOUBLE:
-        return decodeDoubleColumn(buffer, columnEntry, rowCount);
-      case TEXT:
-      case STRING:
-      case BLOB:
-      default:
-        throw new UnsupportedOperationException("PLAIN doesn't support data type: " + dataType);
-    }
-  }
-
-  @Override
-  public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    boolean[] result = new boolean[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readBoolean(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    int[] result = new int[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readInt(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    long[] result = new long[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readLong(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    float[] result = new float[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readFloat(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    double[] result = new double[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readDouble(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("RLE doesn't support data type: " + dataType);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RpcDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RpcDecoder.java
deleted file mode 100644
index 151d8452207..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RpcDecoder.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-import org.apache.iotdb.session.rpccompress.EncodingTypeNotSupportedException;
-import org.apache.iotdb.session.rpccompress.MetaHead;
-
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-
-import java.nio.ByteBuffer;
-import java.util.function.Consumer;
-
-public class RpcDecoder {
-  private MetaHead timeMeta = new MetaHead();
-  private MetaHead valueMeta = new MetaHead();
-
-  private Integer timeMetaLen = 0;
-  private Integer valueMetaLen = 0;
-
-  /**
-   * read timestamps
-   *
-   * @param buffer ByteBuffer
-   * @param size Number of rows
-   */
-  public long[] readTimesFromBuffer(ByteBuffer buffer, int size) {
-    int savePosition = buffer.position();
-    readMetaHeadForTimeStamp(buffer);
-    buffer.position(savePosition);
-    return decodeColumnForTimeStamp(buffer, size);
-  }
-
-  public void readMetaHeadForTimeStamp(ByteBuffer buffer) {
-    this.timeMeta = readMetaHead(buffer, length -> this.timeMetaLen = length);
-  }
-
-  public void readMetaHeadForValues(ByteBuffer buffer) {
-    this.valueMeta = readMetaHead(buffer, length -> this.valueMetaLen = length);
-  }
-
-  public MetaHead readMetaHead(ByteBuffer buffer, Consumer<Integer> length) {
-    // 1. read metaHeader length
-    int MetaHeaderLength = buffer.getInt(buffer.limit() - Integer.BYTES);
-    length.accept(MetaHeaderLength);
-    // 2. read metaHeader
-    byte[] metaBytes = new byte[MetaHeaderLength];
-    buffer.position(buffer.limit() - Integer.BYTES - MetaHeaderLength);
-    buffer.get(metaBytes);
-    // 3. Deserialize metaHeader
-    return MetaHead.fromBytes(metaBytes);
-  }
-
-  public long[] decodeColumnForTimeStamp(ByteBuffer buffer, int rowCount) {
-    ColumnEntry columnEntry = timeMeta.getColumnEntries().get(0);
-    TSDataType dataType = columnEntry.getDataType();
-    TSEncoding encodingType = columnEntry.getEncodingType();
-    ColumnDecoder columnDecoder = createDecoder(dataType, encodingType);
-
-    return columnDecoder.decodeLongColumn(buffer, columnEntry, rowCount);
-  }
-
-  public Object[] decodeValues(ByteBuffer buffer, int rowCount) {
-    int savePosition = buffer.position();
-    readMetaHeadForValues(buffer);
-    buffer.position(savePosition);
-    int columnNum = valueMeta.getColumnEntries().size();
-    Object[] values = new Object[columnNum];
-    for (int i = 0; i < columnNum; i++) {
-      values[i] = decodeColumn(i, buffer, rowCount);
-    }
-    return values;
-  }
-
-  public Object decodeColumn(int columnIndex, ByteBuffer buffer, int rowCount) {
-    ColumnEntry columnEntry = valueMeta.getColumnEntries().get(columnIndex);
-    TSDataType dataType = columnEntry.getDataType();
-    TSEncoding encodingType = columnEntry.getEncodingType();
-    ColumnDecoder columnDecoder = createDecoder(dataType, encodingType);
-
-    return columnDecoder.decode(buffer, columnEntry, rowCount);
-  }
-
-  private ColumnDecoder createDecoder(TSDataType dataType, TSEncoding encodingType) {
-    switch (encodingType) {
-      case PLAIN:
-        return new PlainColumnDecoder(dataType);
-      case RLE:
-        return new RleColumnDecoder(dataType);
-      case TS_2DIFF:
-        return new Ts2DiffColumnDecoder(dataType);
-      case GORILLA:
-        return new GorillaColumnDecoder(dataType);
-      case ZIGZAG:
-        return new ZigzagColumnDecoder(dataType);
-      case CHIMP:
-        return new ChimpColumnDecoder(dataType);
-      case SPRINTZ:
-        return new SprintzColumnDecoder(dataType);
-      case RLBE:
-        return new RlbeColumnDecoder(dataType);
-      case DICTIONARY:
-        return new DictionaryColumnDecoder(dataType);
-      default:
-        throw new EncodingTypeNotSupportedException(encodingType.name());
-    }
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/SprintzColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/SprintzColumnDecoder.java
deleted file mode 100644
index 5785ed3cd91..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/SprintzColumnDecoder.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.exception.encoding.TsFileDecodingException;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.nio.ByteBuffer;
-
-public class SprintzColumnDecoder implements ColumnDecoder {
-  private final Decoder decoder;
-  private final TSDataType dataType;
-
-  public SprintzColumnDecoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.decoder = getDecoder(dataType, TSEncoding.SPRINTZ);
-  }
-
-  @Override
-  public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    switch (dataType) {
-      case INT32:
-      case DATE:
-        return decodeIntColumn(buffer, columnEntry, rowCount);
-      case INT64:
-      case TIMESTAMP:
-        return decodeLongColumn(buffer, columnEntry, rowCount);
-      case FLOAT:
-        return decodeFloatColumn(buffer, columnEntry, rowCount);
-      case DOUBLE:
-        return decodeDoubleColumn(buffer, columnEntry, rowCount);
-      default:
-        throw new TsFileDecodingException("Sprintz doesn't support data type: " + dataType);
-    }
-  }
-
-  @Override
-  public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("Sprintz doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    int[] result = new int[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readInt(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    long[] result = new long[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readLong(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    float[] result = new float[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readFloat(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    double[] result = new double[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readDouble(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("Sprintz doesn't support data type: " + dataType);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/Ts2DiffColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/Ts2DiffColumnDecoder.java
deleted file mode 100644
index 56efc54f7e0..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/Ts2DiffColumnDecoder.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.nio.ByteBuffer;
-
-public class Ts2DiffColumnDecoder implements ColumnDecoder {
-  private final Decoder decoder;
-  private final TSDataType dataType;
-
-  public Ts2DiffColumnDecoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.decoder = getDecoder(dataType, TSEncoding.TS_2DIFF);
-  }
-
-  @Override
-  public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    switch (dataType) {
-      case INT32:
-      case DATE:
-        return decodeIntColumn(buffer, columnEntry, rowCount);
-      case INT64:
-      case TIMESTAMP:
-        return decodeLongColumn(buffer, columnEntry, rowCount);
-      case FLOAT:
-      case DOUBLE:
-        return decodeFloatColumn(buffer, columnEntry, rowCount);
-      default:
-        throw new UnSupportedDataTypeException("TS_2DIFF doesn't support data type: " + dataType);
-    }
-  }
-
-  @Override
-  public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("TS_2DIFF doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    int[] result = new int[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readInt(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    long[] result = new long[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readLong(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    float[] result = new float[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readFloat(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("TS_2DIFF doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new UnSupportedDataTypeException("TS_2DIFF doesn't support data type: " + dataType);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ZigzagColumnDecoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ZigzagColumnDecoder.java
deleted file mode 100644
index a87bae6669c..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ZigzagColumnDecoder.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.decoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.decoder.Decoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.exception.encoding.TsFileDecodingException;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-
-import java.nio.ByteBuffer;
-
-public class ZigzagColumnDecoder implements ColumnDecoder {
-  private final Decoder decoder;
-  private final TSDataType dataType;
-
-  public ZigzagColumnDecoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.decoder = getDecoder(dataType, TSEncoding.ZIGZAG);
-  }
-
-  @Override
-  public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    switch (dataType) {
-      case INT32:
-      case DATE:
-        return decodeIntColumn(buffer, columnEntry, rowCount);
-      case INT64:
-      case TIMESTAMP:
-        return decodeLongColumn(buffer, columnEntry, rowCount);
-      default:
-        throw new TsFileDecodingException(
-            String.format("Zigzag doesn't support data type: " + dataType));
-    }
-  }
-
-  @Override
-  public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new TsFileDecodingException("Zigzag doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public int[] decodeIntColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    int[] result = new int[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readInt(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public long[] decodeLongColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    long[] result = new long[rowCount];
-    for (int i = 0; i < rowCount; i++) {
-      result[i] = decoder.readLong(buffer);
-    }
-    return result;
-  }
-
-  @Override
-  public float[] decodeFloatColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new TsFileDecodingException(
-        String.format("Zigzag doesn't support data type: " + dataType));
-  }
-
-  @Override
-  public double[] decodeDoubleColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new TsFileDecodingException(
-        String.format("Zigzag doesn't support data type: " + dataType));
-  }
-
-  @Override
-  public Binary[] decodeBinaryColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
-    throw new TsFileDecodingException(
-        String.format("Zigzag doesn't support data type: " + dataType));
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ChimpColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ChimpColumnEncoder.java
deleted file mode 100644
index 98cb4908713..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ChimpColumnEncoder.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class ChimpColumnEncoder implements ColumnEncoder {
-  private final Encoder encoder;
-  private final TSDataType dataType;
-  private ColumnEntry columnEntry;
-
-  public ChimpColumnEncoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.encoder = getEncoder(dataType, TSEncoding.CHIMP);
-    columnEntry = new ColumnEntry();
-  }
-
-  @Override
-  public void encode(boolean[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("CHIMP doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(int[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (int value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(long[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (long value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(float[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (float value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(double[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (double value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(Binary[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("CHIMP doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public TSEncoding getEncodingType() {
-    return TSEncoding.CHIMP;
-  }
-
-  @Override
-  public ColumnEntry getColumnEntry() {
-    return columnEntry;
-  }
-
-  private int getUncompressedDataSize(int len) {
-    return getUncompressedDataSize(len, null, dataType);
-  }
-
-  private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
-    columnEntry = new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.CHIMP);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ColumnEncoder.java
deleted file mode 100644
index 4651c28b78f..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ColumnEncoder.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.encoding.encoder.TSEncodingBuilder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-
-import java.io.ByteArrayOutputStream;
-
-/** Column encoder interface, which defines the encoding and decoding operations of column data */
-public interface ColumnEncoder {
-
-  void encode(boolean[] values, ByteArrayOutputStream out);
-
-  void encode(int[] values, ByteArrayOutputStream out);
-
-  void encode(long[] values, ByteArrayOutputStream out);
-
-  void encode(float[] values, ByteArrayOutputStream out);
-
-  void encode(double[] values, ByteArrayOutputStream out);
-
-  void encode(Binary[] values, ByteArrayOutputStream out);
-
-  TSDataType getDataType();
-
-  TSEncoding getEncodingType();
-
-  ColumnEntry getColumnEntry();
-
-  /**
-   * Calculates the uncompressed size in bytes for a column of data, based on the data type and
-   * number of entries.
-   *
-   * @param len the length of arrayList
-   */
-  default int getUncompressedDataSize(int len, Binary[] values, TSDataType dataType) {
-    int unCompressedSize = 0;
-    switch (dataType) {
-      case BOOLEAN:
-        unCompressedSize = 1 * len;
-        break;
-      case INT32:
-      case DATE:
-        unCompressedSize = 4 * len;
-        break;
-      case INT64:
-      case TIMESTAMP:
-        unCompressedSize = 8 * len;
-        break;
-      case FLOAT:
-        unCompressedSize = 4 * len;
-        break;
-      case DOUBLE:
-        unCompressedSize = 8 * len;
-        break;
-      case TEXT:
-      case STRING:
-      case BLOB:
-        for (Binary binary : values) {
-          unCompressedSize += binary.getLength();
-        }
-        break;
-      default:
-        throw new UnsupportedOperationException("Doesn't support data type: " + dataType);
-    }
-    return unCompressedSize;
-  }
-
-  default Encoder getEncoder(TSDataType type, TSEncoding encodingType) {
-    return TSEncodingBuilder.getEncodingBuilder(encodingType).getEncoder(type);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/DictionaryColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/DictionaryColumnEncoder.java
deleted file mode 100644
index 6fd8c4ab10c..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/DictionaryColumnEncoder.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class DictionaryColumnEncoder implements ColumnEncoder {
-  private final Encoder encoder;
-  private final TSDataType dataType;
-  private ColumnEntry columnEntry;
-
-  public DictionaryColumnEncoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.encoder = getEncoder(dataType, TSEncoding.SPRINTZ);
-    columnEntry = new ColumnEntry();
-  }
-
-  @Override
-  public void encode(boolean[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(int[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(long[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(float[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(double[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("Dictionary doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(Binary[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, values, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (Binary value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public TSEncoding getEncodingType() {
-    return TSEncoding.DICTIONARY;
-  }
-
-  @Override
-  public ColumnEntry getColumnEntry() {
-    return columnEntry;
-  }
-
-  private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
-    columnEntry =
-        new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.DICTIONARY);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/GorillaColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/GorillaColumnEncoder.java
deleted file mode 100644
index c32f8c770c1..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/GorillaColumnEncoder.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class GorillaColumnEncoder implements ColumnEncoder {
-  private final Encoder encoder;
-  private final TSDataType dataType;
-  private ColumnEntry columnEntry;
-
-  public GorillaColumnEncoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.encoder = getEncoder(dataType, TSEncoding.GORILLA);
-    columnEntry = new ColumnEntry();
-  }
-
-  @Override
-  public void encode(boolean[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("Gorilla doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(int[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (int value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(long[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (long value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(float[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (float value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(double[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (double value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(Binary[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("Gorilla doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public TSEncoding getEncodingType() {
-    return TSEncoding.GORILLA;
-  }
-
-  @Override
-  public ColumnEntry getColumnEntry() {
-    return columnEntry;
-  }
-
-  private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
-    columnEntry = new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.GORILLA);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/PlainColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/PlainColumnEncoder.java
deleted file mode 100644
index f0492807333..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/PlainColumnEncoder.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.encoding.encoder.PlainEncoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class PlainColumnEncoder implements ColumnEncoder {
-  /** The encoder used to encode the data */
-  private final Encoder encoder;
-
-  private final TSDataType dataType;
-
-  /** ColumnEntry stores metadata for a column's encoded data */
-  private ColumnEntry columnEntry;
-
-  private static final int DEFAULT_MAX_STRING_LENGTH = 0xffff;
-
-  public PlainColumnEncoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.encoder = new PlainEncoder(dataType, DEFAULT_MAX_STRING_LENGTH);
-  }
-
-  /**
-   * Encodes a column of data using the PLAIN encoding algorithm.
-   *
-   * @param values values the input boolean array to be encoded
-   * @param out out the output stream to write the encoded binary data
-   */
-  @Override
-  public void encode(boolean[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (boolean value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(int[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (int value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(long[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (long value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(float[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (float value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(double[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (double value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(Binary[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, values, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (Binary value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  /**
-   * Set column entry metadata
-   *
-   * @param compressedSize the size of the encoded data in bytes after compression
-   * @param unCompressedSize the original size of the data in bytes before compression
-   */
-  private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
-    columnEntry = new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.PLAIN);
-  }
-
-  @Override
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public TSEncoding getEncodingType() {
-    return TSEncoding.PLAIN;
-  }
-
-  @Override
-  public ColumnEntry getColumnEntry() {
-    return columnEntry;
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/RlbeColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/RlbeColumnEncoder.java
deleted file mode 100644
index a3f3a48779e..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/RlbeColumnEncoder.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class RlbeColumnEncoder implements ColumnEncoder {
-  private final Encoder encoder;
-  private final TSDataType dataType;
-  private ColumnEntry columnEntry;
-
-  public RlbeColumnEncoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.encoder = getEncoder(dataType, TSEncoding.RLBE);
-    columnEntry = new ColumnEntry();
-  }
-
-  @Override
-  public void encode(boolean[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("RLBE doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(int[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (int value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(long[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (long value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(float[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (float value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(double[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (double value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(Binary[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("RLBE doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public TSEncoding getEncodingType() {
-    return TSEncoding.RLBE;
-  }
-
-  @Override
-  public ColumnEntry getColumnEntry() {
-    return columnEntry;
-  }
-
-  private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
-    columnEntry = new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.RLBE);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/RleColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/RleColumnEncoder.java
deleted file mode 100644
index 7fc2fdf7ac9..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/RleColumnEncoder.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class RleColumnEncoder implements ColumnEncoder {
-  private final Encoder encoder;
-  private final TSDataType dataType;
-  private ColumnEntry columnEntry;
-
-  public RleColumnEncoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.encoder = getEncoder(dataType, TSEncoding.RLE);
-    columnEntry = new ColumnEntry();
-  }
-
-  @Override
-  public void encode(boolean[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (boolean value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(int[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (int value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(long[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (long value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(float[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (float value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(double[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (double value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(Binary[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("RLE doesn't support data type: " + dataType);
-  }
-
-  private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
-    columnEntry = new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.RLE);
-  }
-
-  @Override
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public TSEncoding getEncodingType() {
-    return TSEncoding.RLE;
-  }
-
-  @Override
-  public ColumnEntry getColumnEntry() {
-    return columnEntry;
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/RpcEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/RpcEncoder.java
deleted file mode 100644
index 8f244ec3022..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/RpcEncoder.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.EncodingTypeNotSupportedException;
-import org.apache.iotdb.session.rpccompress.MetaHead;
-
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-import org.apache.tsfile.write.record.Tablet;
-import org.apache.tsfile.write.schema.IMeasurementSchema;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Map;
-
-public class RpcEncoder {
-  /** MetaHead for values */
-  private final MetaHead metaHeadForValues;
-
-  /** MetaHead for timestamps */
-  private final MetaHead metaHeadForTimeStamp;
-
-  /**
-   * User-specified encoding configurations for time series columns. Can be modified to apply
-   * different encoding strategies per data type.
-   */
-  private final Map<TSDataType, TSEncoding> columnEncodersMap;
-
-  /** Store the length of the MetaHead using a 4-byte integer. */
-  private final int metaHeadLengthInBytes = 4;
-
-  public RpcEncoder(Map<TSDataType, TSEncoding> columnEncodersMap) {
-    this.columnEncodersMap = columnEncodersMap;
-    this.metaHeadForValues = new MetaHead();
-    this.metaHeadForTimeStamp = new MetaHead();
-  }
-
-  /**
-   * Get the timestamp column in tablet
-   *
-   * @param tablet data
-   * @throws IOException An IO exception occurs
-   */
-  public ByteArrayOutputStream encodeTimestamps(Tablet tablet) {
-    // 1.encoder
-    PublicBAOS publicBAOS = new PublicBAOS();
-    ColumnEncoder encoder =
-        createEncoder(
-            TSDataType.INT64, columnEncodersMap.getOrDefault(TSDataType.INT64, TSEncoding.PLAIN));
-    try {
-      long[] timestamps = tablet.getTimestamps();
-      encoder.encode(timestamps, publicBAOS);
-
-      // 2.Get ColumnEntry content and add to metaHead
-      metaHeadForTimeStamp.addColumnEntry(encoder.getColumnEntry());
-
-      // 3.Serialize metaHead and append it to the output stream
-      byte[] metaHeadEncoder = getMetaHeadForTimeStamp().toBytes();
-
-      publicBAOS.write(metaHeadEncoder);
-
-      // 4.Write the length of the serialized metaHead as a 4-byte big-endian integer
-      publicBAOS.write(intToBytes(metaHeadEncoder.length));
-
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-    return publicBAOS;
-  }
-
-  /**
-   * Create the corresponding encoder based on the data type and encoding type
-   *
-   * @param dataType data type
-   * @param encodingType encoding Type
-   * @return columnEncoder
-   */
-  private ColumnEncoder createEncoder(TSDataType dataType, TSEncoding encodingType) {
-    switch (encodingType) {
-      case PLAIN:
-        return new PlainColumnEncoder(dataType);
-      case RLE:
-        return new RleColumnEncoder(dataType);
-      case TS_2DIFF:
-        return new Ts2DiffColumnEncoder(dataType);
-      case GORILLA:
-        return new GorillaColumnEncoder(dataType);
-      case ZIGZAG:
-        return new ZigzagColumnEncoder(dataType);
-      case CHIMP:
-        return new ChimpColumnEncoder(dataType);
-      case SPRINTZ:
-        return new SprintzColumnEncoder(dataType);
-      case RLBE:
-        return new RlbeColumnEncoder(dataType);
-      case DICTIONARY:
-        return new DictionaryColumnEncoder(dataType);
-      default:
-        throw new EncodingTypeNotSupportedException(encodingType.name());
-    }
-  }
-
-  /** Get the value columns from the tablet and encode them into encodedValues */
-  public ByteArrayOutputStream encodeValues(Tablet tablet) {
-    // 1.Encode each column
-    PublicBAOS out = new PublicBAOS();
-    for (int i = 0; i < tablet.getSchemas().size(); i++) {
-      IMeasurementSchema schema = tablet.getSchemas().get(i);
-      encodeColumn(schema.getType(), tablet, i, out);
-    }
-
-    try {
-      // 2.Serializing MetaHead and  append it to the output stream
-      byte[] metaHeadEncoder = getMetaHead().toBytes();
-      out.write(metaHeadEncoder);
-      // 3.Write the length of the serialized metaHead as a 4-byte big-endian integer
-      out.write(intToBytes(metaHeadEncoder.length));
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-    return out;
-  }
-
-  public void encodeColumn(
-      TSDataType dataType, Tablet tablet, int columnIndex, ByteArrayOutputStream out) {
-    // 1.Get the encoding type
-    TSEncoding encoding = columnEncodersMap.getOrDefault(dataType, TSEncoding.PLAIN);
-    ColumnEncoder encoder = createEncoder(dataType, encoding);
-
-    // 2.Get the data of the column
-    Object columnValues = tablet.getValues()[columnIndex];
-
-    // 3.encode
-    switch (dataType) {
-      case INT32:
-        encoder.encode((int[]) columnValues, out);
-        break;
-      case INT64:
-        encoder.encode((long[]) columnValues, out);
-        break;
-      case FLOAT:
-        encoder.encode((float[]) columnValues, out);
-        break;
-      case DOUBLE:
-        encoder.encode((double[]) columnValues, out);
-        break;
-      case BOOLEAN:
-        encoder.encode((boolean[]) columnValues, out);
-        break;
-      case STRING:
-      case BLOB:
-      case TEXT:
-        encoder.encode((Binary[]) columnValues, out);
-        break;
-      default:
-        throw new UnsupportedOperationException("Unsupported data types: " + dataType);
-    }
-
-    // 4.Get ColumnEntry content and add to metaHead
-    metaHeadForValues.addColumnEntry(encoder.getColumnEntry());
-  }
-
-  public static byte[] intToBytes(int value) {
-    return new byte[] {
-      (byte) ((value >>> 24) & 0xFF),
-      (byte) ((value >>> 16) & 0xFF),
-      (byte) ((value >>> 8) & 0xFF),
-      (byte) (value & 0xFF)
-    };
-  }
-
-  /**
-   * Get metadata header
-   *
-   * @return metaHeader
-   */
-  public MetaHead getMetaHead() {
-    return metaHeadForValues;
-  }
-
-  public MetaHead getMetaHeadForTimeStamp() {
-    return metaHeadForTimeStamp;
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/SprintzColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/SprintzColumnEncoder.java
deleted file mode 100644
index 228af3388c9..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/SprintzColumnEncoder.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class SprintzColumnEncoder implements ColumnEncoder {
-  private final Encoder encoder;
-  private final TSDataType dataType;
-  private ColumnEntry columnEntry;
-
-  public SprintzColumnEncoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.encoder = getEncoder(dataType, TSEncoding.SPRINTZ);
-    columnEntry = new ColumnEntry();
-  }
-
-  @Override
-  public void encode(boolean[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("Sprintz doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(int[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (int value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(long[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (long value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(float[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (float value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(double[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (double value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(Binary[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("Sprintz doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public TSEncoding getEncodingType() {
-    return TSEncoding.SPRINTZ;
-  }
-
-  @Override
-  public ColumnEntry getColumnEntry() {
-    return columnEntry;
-  }
-
-  private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
-    columnEntry = new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.SPRINTZ);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/Ts2DiffColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/Ts2DiffColumnEncoder.java
deleted file mode 100644
index 11f54447672..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/Ts2DiffColumnEncoder.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-import org.apache.tsfile.write.UnSupportedDataTypeException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class Ts2DiffColumnEncoder implements ColumnEncoder {
-  private final Encoder encoder;
-  private final TSDataType dataType;
-  private ColumnEntry columnEntry;
-
-  public Ts2DiffColumnEncoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.encoder = getEncoder(dataType, TSEncoding.TS_2DIFF);
-    columnEntry = new ColumnEntry();
-  }
-
-  @Override
-  public void encode(boolean[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("TS_2DIFF doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(
-      int[] values,
-      ByteArrayOutputStream
-          out) { // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (int value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(long[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (long value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(float[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (float value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(double[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("TS_2DIFF doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(Binary[] values, ByteArrayOutputStream out) {
-    throw new UnSupportedDataTypeException("TS_2DIFF doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public TSEncoding getEncodingType() {
-    return TSEncoding.TS_2DIFF;
-  }
-
-  @Override
-  public ColumnEntry getColumnEntry() {
-    return columnEntry;
-  }
-
-  private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
-    columnEntry = new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.TS_2DIFF);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ZigzagColumnEncoder.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ZigzagColumnEncoder.java
deleted file mode 100644
index 301f9db8b64..00000000000
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ZigzagColumnEncoder.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.session.rpccompress.encoder;
-
-import org.apache.iotdb.session.rpccompress.ColumnEntry;
-
-import org.apache.tsfile.encoding.encoder.Encoder;
-import org.apache.tsfile.enums.TSDataType;
-import org.apache.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.tsfile.utils.Binary;
-import org.apache.tsfile.utils.PublicBAOS;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class ZigzagColumnEncoder implements ColumnEncoder {
-  private final Encoder encoder;
-  private final TSDataType dataType;
-  private ColumnEntry columnEntry;
-
-  public ZigzagColumnEncoder(TSDataType dataType) {
-    this.dataType = dataType;
-    this.encoder = getEncoder(dataType, TSEncoding.ZIGZAG);
-    columnEntry = new ColumnEntry();
-  }
-
-  @Override
-  public void encode(boolean[] values, ByteArrayOutputStream out) {
-    throw new UnsupportedOperationException("Zigzag doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(int[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (int value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(long[] values, ByteArrayOutputStream out) {
-    // 1. Calculate the uncompressed size in bytes for the column of data.
-    int unCompressedSize = getUncompressedDataSize(values.length, null, dataType);
-    PublicBAOS outputStream = new PublicBAOS(unCompressedSize);
-    try {
-      // 2. Encodes the input array using the corresponding encoder from TsFile.
-      for (long value : values) {
-        encoder.encode(value, outputStream);
-      }
-      // 3.Flushes any buffered encoding data into the outputStream.
-      encoder.flush(outputStream);
-      byte[] encodedData = outputStream.toByteArray();
-      // 4. Set column entry metadata
-      setColumnEntry(encodedData.length, unCompressedSize);
-      if (out != null) {
-        out.write(encodedData);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public void encode(float[] values, ByteArrayOutputStream out) {
-    throw new UnsupportedOperationException("Zigzag doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(double[] values, ByteArrayOutputStream out) {
-    throw new UnsupportedOperationException("Zigzag doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public void encode(Binary[] values, ByteArrayOutputStream out) {
-    throw new UnsupportedOperationException("Zigzag doesn't support data type: " + dataType);
-  }
-
-  @Override
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public TSEncoding getEncodingType() {
-    return TSEncoding.ZIGZAG;
-  }
-
-  @Override
-  public ColumnEntry getColumnEntry() {
-    return columnEntry;
-  }
-
-  private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
-    columnEntry = new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.ZIGZAG);
-  }
-}
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/subscription/payload/SubscriptionSessionDataSet.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/subscription/payload/SubscriptionSessionDataSet.java
index 6bb4a8d7b86..a3f7f8e3f26 100644
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/subscription/payload/SubscriptionSessionDataSet.java
+++ b/iotdb-client/session/src/main/java/org/apache/iotdb/session/subscription/payload/SubscriptionSessionDataSet.java
@@ -31,7 +31,6 @@ import org.apache.tsfile.utils.BitMap;
 import org.apache.tsfile.utils.DateUtils;
 import org.apache.tsfile.write.UnSupportedDataTypeException;
 import org.apache.tsfile.write.record.Tablet;
-import org.apache.tsfile.write.record.Tablet.ColumnCategory;
 import org.apache.tsfile.write.schema.IMeasurementSchema;
 
 import java.time.LocalDate;
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/util/SessionUtils.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/util/SessionUtils.java
index 8534b808754..6867a7134f6 100644
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/util/SessionUtils.java
+++ b/iotdb-client/session/src/main/java/org/apache/iotdb/session/util/SessionUtils.java
@@ -24,6 +24,7 @@ import org.apache.iotdb.rpc.IoTDBConnectionException;
 import org.apache.iotdb.rpc.UrlUtils;
 
 import org.apache.tsfile.common.conf.TSFileConfig;
+import org.apache.tsfile.encoding.encoder.Encoder;
 import org.apache.tsfile.enums.TSDataType;
 import org.apache.tsfile.file.metadata.IDeviceID;
 import org.apache.tsfile.utils.Binary;
@@ -35,6 +36,7 @@ import org.apache.tsfile.write.UnSupportedDataTypeException;
 import org.apache.tsfile.write.record.Tablet;
 import org.apache.tsfile.write.schema.IMeasurementSchema;
 
+import java.io.ByteArrayOutputStream;
 import java.nio.ByteBuffer;
 import java.time.LocalDate;
 import java.util.ArrayList;
@@ -346,6 +348,129 @@ public class SessionUtils {
     }
   }
 
+  public static void encodeValue(
+      TSDataType dataType,
+      Tablet tablet,
+      int i,
+      Encoder encoder,
+      ByteArrayOutputStream outputStream) {
+
+    switch (dataType) {
+      case INT32:
+        int[] intValues = (int[]) tablet.getValues()[i];
+        for (int index = 0; index < tablet.getRowSize(); index++) {
+          if (!tablet.isNull(index, i)) {
+            encoder.encode(intValues[index], outputStream);
+          } else {
+            // use the previous value as the placeholder of nulls to increase encoding performance
+            if (index == 0) {
+              encoder.encode(intValues[index], outputStream);
+            } else {
+              encoder.encode(intValues[index - 1], outputStream);
+            }
+          }
+        }
+        break;
+      case INT64:
+      case TIMESTAMP:
+        long[] longValues = (long[]) tablet.getValues()[i];
+        for (int index = 0; index < tablet.getRowSize(); index++) {
+          if (!tablet.isNull(index, i)) {
+            encoder.encode(longValues[index], outputStream);
+          } else {
+            // use the previous value as the placeholder of nulls to increase encoding performance
+            if (index == 0) {
+              encoder.encode(longValues[index], outputStream);
+            } else {
+              encoder.encode(longValues[index - 1], outputStream);
+            }
+          }
+        }
+        break;
+      case FLOAT:
+        float[] floatValues = (float[]) tablet.getValues()[i];
+        for (int index = 0; index < tablet.getRowSize(); index++) {
+          if (!tablet.isNull(index, i)) {
+            encoder.encode(floatValues[index], outputStream);
+          } else {
+            // use the previous value as the placeholder of nulls to increase encoding performance
+            if (index == 0) {
+              encoder.encode(floatValues[index], outputStream);
+            } else {
+              encoder.encode(floatValues[index - 1], outputStream);
+            }
+          }
+        }
+        break;
+      case DOUBLE:
+        double[] doubleValues = (double[]) tablet.getValues()[i];
+        for (int index = 0; index < tablet.getRowSize(); index++) {
+          if (!tablet.isNull(index, i)) {
+            encoder.encode(doubleValues[index], outputStream);
+          } else {
+            // use the previous value as the placeholder of nulls to increase encoding performance
+            if (index == 0) {
+              encoder.encode(doubleValues[index], outputStream);
+            } else {
+              encoder.encode(doubleValues[index - 1], outputStream);
+            }
+          }
+        }
+        break;
+      case BOOLEAN:
+        boolean[] boolValues = (boolean[]) tablet.getValues()[i];
+        for (int index = 0; index < tablet.getRowSize(); index++) {
+          if (!tablet.isNull(index, i)) {
+            encoder.encode(boolValues[index], outputStream);
+          } else {
+            // use the previous value as the placeholder of nulls to increase encoding performance
+            if (index == 0) {
+              encoder.encode(boolValues[index], outputStream);
+            } else {
+              encoder.encode(boolValues[index - 1], outputStream);
+            }
+          }
+        }
+        break;
+      case TEXT:
+      case STRING:
+      case BLOB:
+        Binary[] binaryValues = (Binary[]) tablet.getValues()[i];
+        for (int index = 0; index < tablet.getRowSize(); index++) {
+          if (!tablet.isNull(index, i)) {
+            encoder.encode(binaryValues[index], outputStream);
+          } else {
+            // use the previous value as the placeholder of nulls to increase encoding performance
+            if (index == 0) {
+              encoder.encode(Binary.EMPTY_VALUE, outputStream);
+            } else {
+              encoder.encode(binaryValues[index - 1], outputStream);
+            }
+          }
+        }
+        break;
+      case DATE:
+        LocalDate[] dateValues = (LocalDate[]) tablet.getValues()[i];
+        for (int index = 0; index < tablet.getRowSize(); index++) {
+          if (!tablet.isNull(index, i)) {
+            encoder.encode(DateUtils.parseDateExpressionToInt(dateValues[index]), outputStream);
+          } else {
+            // use the previous value as the placeholder of nulls to increase encoding performance
+            if (index == 0) {
+              encoder.encode(EMPTY_DATE_INT, outputStream);
+            } else {
+              encoder.encode(
+                  DateUtils.parseDateExpressionToInt(dateValues[index - 1]), outputStream);
+            }
+          }
+        }
+        break;
+      default:
+        throw new UnSupportedDataTypeException(
+            String.format("Data type %s is not supported.", dataType));
+    }
+  }
+
   /* Used for table model insert only. */
   public static boolean isTabletContainsSingleDevice(Tablet tablet) {
     if (tablet.getRowSize() == 1) {
diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java
index a969c8d0c70..40268a54cd3 100644
--- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java
+++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java
@@ -32,11 +32,11 @@ import org.apache.iotdb.service.rpc.thrift.TSInsertStringRecordsReq;
 import org.apache.iotdb.service.rpc.thrift.TSInsertTabletReq;
 import org.apache.iotdb.service.rpc.thrift.TSInsertTabletsReq;
 
+import org.apache.tsfile.enums.ColumnCategory;
 import org.apache.tsfile.enums.TSDataType;
 import org.apache.tsfile.file.metadata.IDeviceID;
 import org.apache.tsfile.file.metadata.StringArrayDeviceID;
 import org.apache.tsfile.write.record.Tablet;
-import org.apache.tsfile.write.record.Tablet.ColumnCategory;
 import org.apache.tsfile.write.schema.IMeasurementSchema;
 import org.apache.tsfile.write.schema.MeasurementSchema;
 import org.junit.Assert;
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
index 8087a3f94f9..8d5fe8d48f0 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
@@ -27,7 +27,6 @@ import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
 import org.apache.iotdb.commons.service.metric.PerformanceOverviewMetrics;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.protocol.thrift.handler.RPCServiceThriftHandlerMetrics;
 import org.apache.iotdb.db.qp.sql.IoTDBSqlParser;
 import org.apache.iotdb.db.qp.sql.SqlLexer;
 import org.apache.iotdb.db.queryengine.plan.analyze.cache.schema.DataNodeDevicePathCache;
@@ -92,8 +91,7 @@ import org.apache.iotdb.service.rpc.thrift.TSQueryTemplateReq;
 import org.apache.iotdb.service.rpc.thrift.TSRawDataQueryReq;
 import org.apache.iotdb.service.rpc.thrift.TSSetSchemaTemplateReq;
 import org.apache.iotdb.service.rpc.thrift.TSUnsetSchemaTemplateReq;
-import org.apache.iotdb.session.rpccompress.RpcUncompressor;
-import org.apache.iotdb.session.rpccompress.decoder.RpcDecoder;
+import org.apache.iotdb.util.TabletDecoder;
 
 import org.antlr.v4.runtime.CharStream;
 import org.antlr.v4.runtime.CharStreams;
@@ -101,12 +99,13 @@ import org.antlr.v4.runtime.CommonTokenStream;
 import org.antlr.v4.runtime.atn.PredictionMode;
 import org.antlr.v4.runtime.tree.ParseTree;
 import org.apache.tsfile.common.constant.TsFileConstant;
+import org.apache.tsfile.enums.ColumnCategory;
 import org.apache.tsfile.enums.TSDataType;
 import org.apache.tsfile.file.metadata.enums.CompressionType;
 import org.apache.tsfile.file.metadata.enums.TSEncoding;
+import org.apache.tsfile.utils.Pair;
 import org.apache.tsfile.utils.ReadWriteIOUtils;
 import org.apache.tsfile.utils.TimeDuration;
-import org.apache.tsfile.write.record.Tablet.ColumnCategory;
 
 import java.nio.ByteBuffer;
 import java.time.ZoneId;
@@ -116,6 +115,7 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /** Convert SQL and RPC requests to {@link Statement}. */
 public class StatementGenerator {
@@ -335,117 +335,37 @@ public class StatementGenerator {
     insertStatement.setDevicePath(
         DEVICE_PATH_CACHE.getPartialPath(insertTabletReq.getPrefixPath()));
     insertStatement.setMeasurements(insertTabletReq.getMeasurements().toArray(new String[0]));
-    long[] timestamps;
-
-    long startDeCompressedTimes = 0L;
-    long endDeCompressedTimes = 0L;
-    long startDecodeTime = 0L;
-    long endDecodeTime = 0L;
-
-    long startDeCompressedValue = 0L;
-    long endDeCompressedValue = 0L;
-    long startDecodeValue = 0L;
-    long endDecodeValue = 0L;
-
-    int uncompressedTimestampsSize = 0;
-    int uncompressedValuesSize = 0;
-
-    try {
-      if (insertTabletReq.isIsCompressed()) {
-        startDeCompressedTimes = System.nanoTime();
-        RpcDecoder rpcDecoder = new RpcDecoder();
-        RpcUncompressor rpcUncompressor =
-            new RpcUncompressor(
-                CompressionType.deserialize((byte) insertTabletReq.getCompressType()));
-        ByteBuffer uncompressedTimestamps = rpcUncompressor.uncompress(insertTabletReq.timestamps);
-        uncompressedTimestampsSize = uncompressedTimestamps.remaining();
-        endDeCompressedTimes = System.nanoTime();
-
-        startDecodeTime = System.nanoTime();
-        timestamps = rpcDecoder.readTimesFromBuffer(uncompressedTimestamps, insertTabletReq.size);
-        endDecodeTime = System.nanoTime();
-      } else {
-        timestamps =
-            QueryDataSetUtils.readTimesFromBuffer(insertTabletReq.timestamps, insertTabletReq.size);
-      }
-
-      if (timestamps.length != 0) {
-        TimestampPrecisionUtils.checkTimestampPrecision(timestamps[timestamps.length - 1]);
-      }
-      insertStatement.setTimes(timestamps);
-      // decode values
-      if (insertTabletReq.isIsCompressed()) {
-        startDeCompressedValue = System.nanoTime();
-        RpcDecoder rpcDecoder = new RpcDecoder();
-        RpcUncompressor rpcUncompressor =
-            new RpcUncompressor(
-                CompressionType.deserialize((byte) insertTabletReq.getCompressType()));
-        ByteBuffer uncompressedValues = rpcUncompressor.uncompress(insertTabletReq.values);
-        uncompressedValuesSize = uncompressedValues.remaining();
-        endDeCompressedValue = System.nanoTime();
-
-        startDecodeValue = System.nanoTime();
-        insertStatement.setColumns(
-            rpcDecoder.decodeValues(uncompressedValues, insertTabletReq.size));
-        endDecodeValue = System.nanoTime();
-      } else {
-        insertStatement.setColumns(
-            QueryDataSetUtils.readTabletValuesFromBuffer(
-                insertTabletReq.values,
-                insertTabletReq.types,
-                insertTabletReq.types.size(),
-                insertTabletReq.size));
-        insertStatement.setBitMaps(
-            QueryDataSetUtils.readBitMapsFromBuffer(
-                    insertTabletReq.values, insertTabletReq.types.size(), insertTabletReq.size)
-                .orElse(null));
-      }
-    } finally {
-      System.out.println("YYM");
-      RPCServiceThriftHandlerMetrics.getInstance()
-          .recordDecompressLatencyTimer(
-              (endDeCompressedValue
-                  - startDeCompressedValue
-                  + endDeCompressedTimes
-                  - startDeCompressedTimes));
-
-      RPCServiceThriftHandlerMetrics.getInstance()
-          .recordDecodeLatencyTimer(
-              (endDecodeValue - startDecodeValue + endDecodeTime - startDecodeTime));
-
-      if (insertTabletReq.isIsCompressed()) {
-        RPCServiceThriftHandlerMetrics.getInstance()
-            .recordUnCompressionSizeTimer((uncompressedTimestampsSize + uncompressedValuesSize));
-
-        long memoryUsage =
-            uncompressedTimestampsSize
-                + uncompressedValuesSize
-                + insertTabletReq.timestamps.remaining()
-                + insertTabletReq.values.remaining();
-        System.out.println(memoryUsage);
-        RPCServiceThriftHandlerMetrics.getInstance().recordMemoryUsage(memoryUsage);
-      } else {
-        RPCServiceThriftHandlerMetrics.getInstance()
-            .recordUnCompressionSizeTimer(
-                (insertTabletReq.timestamps.remaining() + insertTabletReq.values.remaining()));
-
-        long memoryUsage =
-            insertTabletReq.timestamps.remaining() + insertTabletReq.values.remaining();
-        RPCServiceThriftHandlerMetrics.getInstance().recordMemoryUsage(memoryUsage);
-      }
-
-      RPCServiceThriftHandlerMetrics.getInstance()
-          .recordCompressionSizeTimer(
-              (insertTabletReq.timestamps.remaining() + insertTabletReq.values.remaining()));
-      System.out.println(
-          insertTabletReq.timestamps.remaining() + insertTabletReq.values.remaining());
-    }
-    insertStatement.setRowCount(insertTabletReq.size);
     TSDataType[] dataTypes = new TSDataType[insertTabletReq.types.size()];
     for (int i = 0; i < insertTabletReq.types.size(); i++) {
       dataTypes[i] = TSDataType.deserialize((byte) insertTabletReq.types.get(i).intValue());
     }
     insertStatement.setDataTypes(dataTypes);
+
+    TabletDecoder tabletDecoder =
+        new TabletDecoder(
+            insertTabletReq.isIsCompressed()
+                ? CompressionType.deserialize(insertTabletReq.getCompressType())
+                : CompressionType.UNCOMPRESSED,
+            dataTypes,
+            insertTabletReq.isIsCompressed()
+                ? insertTabletReq.encodingTypes.stream()
+                    .map(TSEncoding::deserialize)
+                    .collect(Collectors.toList())
+                : Collections.nCopies(dataTypes.length + 1, TSEncoding.PLAIN),
+            insertTabletReq.size);
+
+    long[] timestamps = tabletDecoder.decodeTime(insertTabletReq.timestamps);
+    Pair<Object[], ByteBuffer> valueAndRemainingBuffer =
+        tabletDecoder.decodeValues(insertTabletReq.values);
+    insertStatement.setTimes(timestamps);
+    insertStatement.setColumns(valueAndRemainingBuffer.left);
+    insertStatement.setBitMaps(
+        QueryDataSetUtils.readBitMapsFromBuffer(
+                valueAndRemainingBuffer.right, insertTabletReq.types.size(), insertTabletReq.size)
+            .orElse(null));
+
+    insertStatement.setRowCount(insertTabletReq.size);
+
     insertStatement.setAligned(insertTabletReq.isAligned);
     insertStatement.setWriteToTable(insertTabletReq.isWriteToTable());
     if (insertTabletReq.isWriteToTable()) {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/util/TabletDecoder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/util/TabletDecoder.java
new file mode 100644
index 00000000000..66afdc3dd03
--- /dev/null
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/util/TabletDecoder.java
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.util;
+
+import org.apache.iotdb.commons.exception.IoTDBRuntimeException;
+import org.apache.iotdb.db.protocol.thrift.handler.RPCServiceThriftHandlerMetrics;
+import org.apache.iotdb.rpc.TSStatusCode;
+
+import org.apache.tsfile.compress.IUnCompressor;
+import org.apache.tsfile.encoding.decoder.Decoder;
+import org.apache.tsfile.enums.TSDataType;
+import org.apache.tsfile.file.metadata.enums.CompressionType;
+import org.apache.tsfile.file.metadata.enums.TSEncoding;
+import org.apache.tsfile.utils.Binary;
+import org.apache.tsfile.utils.Pair;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public class TabletDecoder {
+
+  private final CompressionType compressionType;
+  private final TSDataType[] dataTypes;
+  private final List<TSEncoding> columnEncodings;
+  private final IUnCompressor unCompressor;
+  private final int rowSize;
+
+  /**
+   * @param compressionType the overall compression
+   * @param dataTypes data types of each column
+   * @param columnEncodings encoding method of each column, the first column is the time column
+   * @param rowSize number of rows
+   */
+  public TabletDecoder(
+      CompressionType compressionType,
+      TSDataType[] dataTypes,
+      List<TSEncoding> columnEncodings,
+      int rowSize) {
+    this.compressionType = compressionType;
+    this.dataTypes = dataTypes;
+    this.columnEncodings = columnEncodings;
+    this.unCompressor = IUnCompressor.getUnCompressor(compressionType);
+    this.rowSize = rowSize;
+  }
+
+  public long[] decodeTime(ByteBuffer buffer) {
+    int compressedSize = buffer.remaining();
+
+    ByteBuffer uncompressedBuffer = uncompress(buffer);
+    RPCServiceThriftHandlerMetrics.getInstance()
+        .recordUnCompressionSizeTimer(uncompressedBuffer.remaining());
+    RPCServiceThriftHandlerMetrics.getInstance().recordCompressionSizeTimer(compressedSize);
+
+    long memoryUsage =
+        compressionType == CompressionType.UNCOMPRESSED
+            ? uncompressedBuffer.remaining()
+            : uncompressedBuffer.remaining() + compressedSize;
+    RPCServiceThriftHandlerMetrics.getInstance().recordMemoryUsage(memoryUsage);
+
+    long startDecodeTime = System.nanoTime();
+    long[] timeStamps = decodeColumnForTimeStamp(uncompressedBuffer, rowSize);
+    RPCServiceThriftHandlerMetrics.getInstance()
+        .recordDecodeLatencyTimer((System.nanoTime() - startDecodeTime));
+    return timeStamps;
+  }
+
+  private ByteBuffer uncompress(ByteBuffer compressedBuffer) {
+    long startUncompressTime = System.nanoTime();
+    if (compressionType == CompressionType.UNCOMPRESSED) {
+      return compressedBuffer;
+    }
+    try {
+      int uncompressedLength = compressedBuffer.getInt(compressedBuffer.limit() - 4);
+      ByteBuffer output = ByteBuffer.allocate(uncompressedLength);
+      byte[] compressedData = new byte[compressedBuffer.remaining() - 4];
+      compressedBuffer.slice().get(compressedData);
+      byte[] uncompressedData = unCompressor.uncompress(compressedData);
+      output.put(uncompressedData);
+      output.flip();
+      RPCServiceThriftHandlerMetrics.getInstance()
+          .recordDecompressLatencyTimer(System.nanoTime() - startUncompressTime);
+      return output;
+    } catch (IOException e) {
+      throw new IoTDBRuntimeException(
+          "Failed to decompress compressedBuffer",
+          e,
+          TSStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
+    }
+  }
+
+  private long[] decodeColumnForTimeStamp(ByteBuffer buffer, int rowCount) {
+    TSDataType dataType = TSDataType.INT64;
+    TSEncoding encodingType = columnEncodings.get(0);
+
+    Decoder decoder = Decoder.getDecoderByType(encodingType, dataType);
+    long[] result = new long[rowCount];
+    for (int i = 0; i < rowCount; i++) {
+      result[i] = decoder.readLong(buffer);
+    }
+    return result;
+  }
+
+  public Pair<Object[], ByteBuffer> decodeValues(ByteBuffer buffer) {
+    int compressedSize = buffer.remaining();
+    ByteBuffer uncompressed = uncompress(buffer);
+    RPCServiceThriftHandlerMetrics.getInstance()
+        .recordUnCompressionSizeTimer(uncompressed.remaining());
+    RPCServiceThriftHandlerMetrics.getInstance().recordCompressionSizeTimer(compressedSize);
+
+    long startDecodeTime = System.nanoTime();
+    Object[] columns = new Object[dataTypes.length];
+    for (int i = 0; i < dataTypes.length; i++) {
+      columns[i] = decodeColumn(uncompressed, i);
+    }
+
+    RPCServiceThriftHandlerMetrics.getInstance()
+        .recordDecodeLatencyTimer(System.nanoTime() - startDecodeTime);
+    return new Pair<>(columns, uncompressed);
+  }
+
+  private Object decodeColumn(ByteBuffer uncompressed, int columnIndex) {
+    TSDataType dataType = dataTypes[columnIndex];
+    TSEncoding encoding = columnEncodings.get(columnIndex + 1);
+
+    Decoder decoder = Decoder.getDecoderByType(encoding, dataType);
+    Object column = null;
+    switch (dataType) {
+      case DATE:
+      case INT32:
+        int[] intCol = new int[rowSize];
+        for (int j = 0; j < rowSize; j++) {
+          intCol[j] = decoder.readInt(uncompressed);
+        }
+        column = intCol;
+        break;
+      case INT64:
+      case TIMESTAMP:
+        long[] longCol = new long[rowSize];
+        for (int j = 0; j < rowSize; j++) {
+          longCol[j] = decoder.readLong(uncompressed);
+        }
+        column = longCol;
+        break;
+      case FLOAT:
+        float[] floatCol = new float[rowSize];
+        for (int j = 0; j < rowSize; j++) {
+          floatCol[j] = decoder.readFloat(uncompressed);
+        }
+        column = floatCol;
+        break;
+      case DOUBLE:
+        double[] doubleCol = new double[rowSize];
+        for (int j = 0; j < rowSize; j++) {
+          doubleCol[j] = decoder.readDouble(uncompressed);
+        }
+        column = doubleCol;
+        break;
+      case BOOLEAN:
+        boolean[] boolCol = new boolean[rowSize];
+        for (int j = 0; j < rowSize; j++) {
+          boolCol[j] = decoder.readBoolean(uncompressed);
+        }
+        column = boolCol;
+        break;
+      case STRING:
+      case BLOB:
+      case TEXT:
+        Binary[] binaryCol = new Binary[rowSize];
+        for (int j = 0; j < rowSize; j++) {
+          binaryCol[j] = decoder.readBinary(uncompressed);
+        }
+        column = binaryCol;
+        break;
+      case UNKNOWN:
+      case VECTOR:
+        throw new IllegalArgumentException("Unsupported data type: " + dataType);
+    }
+    return column;
+  }
+}
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnCategory.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnCategory.java
index 9f6dcd6019c..0ee7133b2d0 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnCategory.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnCategory.java
@@ -19,8 +19,8 @@
 
 package org.apache.iotdb.commons.schema.table.column;
 
+import org.apache.tsfile.enums.ColumnCategory;
 import org.apache.tsfile.utils.ReadWriteIOUtils;
-import org.apache.tsfile.write.record.Tablet.ColumnCategory;
 
 import java.io.IOException;
 import java.io.InputStream;
diff --git a/iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift b/iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift
index ebd37cdfa89..635eec82993 100644
--- a/iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift
+++ b/iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift
@@ -243,8 +243,8 @@ struct TSInsertTabletReq {
   9: optional bool writeToTable
   10: optional list<byte> columnCategories
   11: optional bool isCompressed
-  12: optional list<i32> encodingTypes
-  13: optional i32 compressType
+  12: optional list<byte> encodingTypes
+  13: optional byte compressType
 }
 
 struct TSInsertTabletsReq {