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

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

commit 95a997fbb05d085f6d2c7cddeaacf574e9dcf784
Author: shuwenwei <[email protected]>
AuthorDate: Wed Jan 21 09:57:59 2026 +0800

    Remove some method implementations related to the object type
---
 .../impl/DataNodeInternalRPCServiceImpl.java       |  8 ---
 .../operator/process/function/partition/Slice.java |  6 +--
 .../relational/aggregation/RecordIterator.java     |  6 +--
 .../org/apache/iotdb/db/utils/ObjectTypeUtils.java | 61 +---------------------
 .../commons/exception/ObjectFileNotExist.java      |  6 ++-
 .../src/main/thrift/datanode.thrift                |  8 ---
 6 files changed, 8 insertions(+), 87 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
index 4c230a2823a..46d377be0a1 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
@@ -205,7 +205,6 @@ import 
org.apache.iotdb.db.subscription.agent.SubscriptionAgent;
 import org.apache.iotdb.db.trigger.executor.TriggerExecutor;
 import org.apache.iotdb.db.trigger.executor.TriggerFireResult;
 import org.apache.iotdb.db.trigger.service.TriggerManagementService;
-import org.apache.iotdb.db.utils.ObjectTypeUtils;
 import org.apache.iotdb.db.utils.SetThreadName;
 import org.apache.iotdb.metrics.type.AutoGauge;
 import org.apache.iotdb.metrics.utils.MetricLevel;
@@ -285,7 +284,6 @@ import 
org.apache.iotdb.mpp.rpc.thrift.TPushSingleTopicMetaReq;
 import org.apache.iotdb.mpp.rpc.thrift.TPushTopicMetaReq;
 import org.apache.iotdb.mpp.rpc.thrift.TPushTopicMetaResp;
 import org.apache.iotdb.mpp.rpc.thrift.TPushTopicMetaRespExceptionMessage;
-import org.apache.iotdb.mpp.rpc.thrift.TReadObjectReq;
 import org.apache.iotdb.mpp.rpc.thrift.TRegionLeaderChangeReq;
 import org.apache.iotdb.mpp.rpc.thrift.TRegionLeaderChangeResp;
 import org.apache.iotdb.mpp.rpc.thrift.TRegionMigrateResult;
@@ -3101,12 +3099,6 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
     return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
   }
 
-  @Override
-  public ByteBuffer readObject(TReadObjectReq req) {
-    return ObjectTypeUtils.readObjectContent(
-        req.getRelativePath(), req.getOffset(), req.getSize(), false);
-  }
-
   public void handleClientExit() {
     // Do nothing
   }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/process/function/partition/Slice.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/process/function/partition/Slice.java
index e05381f6de4..f8f002d5e19 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/process/function/partition/Slice.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/process/function/partition/Slice.java
@@ -230,11 +230,7 @@ public class Slice {
 
     @Override
     public Binary readObject(int columnIndex, long offset, int length) {
-      if (getDataType(columnIndex) != Type.OBJECT) {
-        throw new UnsupportedOperationException("current column is not object 
column");
-      }
-      Binary binary = getBinarySafely(columnIndex);
-      return new Binary(ObjectTypeUtils.readObjectContent(binary, offset, 
length, true).array());
+      throw new UnsupportedOperationException("readObject is not supported");
     }
 
     @Override
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/RecordIterator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/RecordIterator.java
index 3f3943f9bc3..fcb0bf93cfd 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/RecordIterator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/RecordIterator.java
@@ -175,11 +175,7 @@ public class RecordIterator implements Iterator<Record> {
 
     @Override
     public Binary readObject(int columnIndex, long offset, int length) {
-      if (getDataType(columnIndex) != Type.OBJECT) {
-        throw new UnsupportedOperationException("current column is not object 
column");
-      }
-      Binary binary = getBinarySafely(columnIndex);
-      return new Binary(ObjectTypeUtils.readObjectContent(binary, offset, 
length, true).array());
+      throw new UnsupportedOperationException("readObject is not supported");
     }
 
     @Override
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectTypeUtils.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectTypeUtils.java
index 7148bca87e8..6d61056ed6a 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectTypeUtils.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectTypeUtils.java
@@ -19,20 +19,12 @@
 
 package org.apache.iotdb.db.utils;
 
-import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
-import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
-import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
-import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
-import org.apache.iotdb.commons.client.sync.SyncDataNodeInternalServiceClient;
 import org.apache.iotdb.commons.exception.IoTDBRuntimeException;
 import org.apache.iotdb.commons.exception.ObjectFileNotExist;
 import org.apache.iotdb.db.exception.sql.SemanticException;
-import org.apache.iotdb.db.queryengine.plan.Coordinator;
-import org.apache.iotdb.db.queryengine.plan.analyze.ClusterPartitionFetcher;
 import org.apache.iotdb.db.service.metrics.FileMetrics;
 import org.apache.iotdb.db.storageengine.dataregion.IObjectPath;
 import org.apache.iotdb.db.storageengine.rescon.disk.TierManager;
-import org.apache.iotdb.mpp.rpc.thrift.TReadObjectReq;
 import org.apache.iotdb.rpc.TSStatusCode;
 
 import org.apache.tsfile.encoding.decoder.Decoder;
@@ -48,10 +40,7 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
 import java.nio.file.Files;
-import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
-import java.util.Collections;
-import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
 
@@ -101,55 +90,7 @@ public class ObjectTypeUtils {
 
   private static ByteBuffer readObjectContentFromRemoteFile(
       final String relativePath, final long offset, final int readSize) {
-    int regionId;
-    try {
-      regionId = 
Integer.parseInt(Paths.get(relativePath).getName(0).toString());
-    } catch (NumberFormatException e) {
-      throw new IoTDBRuntimeException(
-          "wrong object file path: " + relativePath,
-          TSStatusCode.OBJECT_READ_ERROR.getStatusCode());
-    }
-    TConsensusGroupId consensusGroupId =
-        new TConsensusGroupId(TConsensusGroupType.DataRegion, regionId);
-    List<TRegionReplicaSet> regionReplicaSetList =
-        ClusterPartitionFetcher.getInstance()
-            .getRegionReplicaSet(Collections.singletonList(consensusGroupId));
-    if (regionReplicaSetList.isEmpty()) {
-      throw new ObjectFileNotExist(relativePath);
-    }
-    TRegionReplicaSet regionReplicaSet = 
regionReplicaSetList.iterator().next();
-    if (regionReplicaSet.getDataNodeLocations().isEmpty()) {
-      throw new ObjectFileNotExist(relativePath);
-    }
-    final int batchSize = 1024 * 1024;
-    final TReadObjectReq req = new TReadObjectReq();
-    req.setRelativePath(relativePath);
-    ByteBuffer buffer = ByteBuffer.allocate(readSize);
-    for (int i = 0; i < regionReplicaSet.getDataNodeLocations().size(); i++) {
-      TDataNodeLocation dataNodeLocation = 
regionReplicaSet.getDataNodeLocations().get(i);
-      int toReadSizeInCurrentDataNode = readSize;
-      try (SyncDataNodeInternalServiceClient client =
-          Coordinator.getInstance()
-              .getInternalServiceClientManager()
-              .borrowClient(dataNodeLocation.getInternalEndPoint())) {
-        while (toReadSizeInCurrentDataNode > 0) {
-          req.setOffset(offset + buffer.position());
-          req.setSize(Math.min(toReadSizeInCurrentDataNode, batchSize));
-          toReadSizeInCurrentDataNode -= req.getSize();
-          ByteBuffer partial = client.readObject(req);
-          buffer.put(partial);
-        }
-      } catch (Exception e) {
-        logger.warn("Failed to read object from datanode: {}", 
dataNodeLocation, e);
-        if (i == regionReplicaSet.getDataNodeLocations().size() - 1) {
-          throw new IoTDBRuntimeException(e, 
TSStatusCode.OBJECT_READ_ERROR.getStatusCode());
-        }
-        continue;
-      }
-      break;
-    }
-    buffer.flip();
-    return buffer;
+    throw new UnsupportedOperationException("readObjectContentFromRemoteFile");
   }
 
   public static Binary generateObjectBinary(long objectSize, IObjectPath 
objectPath) {
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/exception/ObjectFileNotExist.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/exception/ObjectFileNotExist.java
index 05add08b218..afe2cda5500 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/exception/ObjectFileNotExist.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/exception/ObjectFileNotExist.java
@@ -19,6 +19,8 @@
 
 package org.apache.iotdb.commons.exception;
 
+import org.apache.iotdb.rpc.RpcUtils;
+
 import static org.apache.iotdb.rpc.TSStatusCode.OBJECT_NOT_EXISTS;
 
 public class ObjectFileNotExist extends IoTDBRuntimeException {
@@ -26,6 +28,8 @@ public class ObjectFileNotExist extends IoTDBRuntimeException 
{
   private static final String ERROR_MSG = "Object file %s does not exist";
 
   public ObjectFileNotExist(String relativeObjectPath) {
-    super(String.format(ERROR_MSG, relativeObjectPath), 
OBJECT_NOT_EXISTS.getStatusCode());
+    super(
+        RpcUtils.getStatus(
+            OBJECT_NOT_EXISTS.getStatusCode(), String.format(ERROR_MSG, 
relativeObjectPath)));
   }
 }
diff --git a/iotdb-protocol/thrift-datanode/src/main/thrift/datanode.thrift 
b/iotdb-protocol/thrift-datanode/src/main/thrift/datanode.thrift
index 6166e29161a..cca7110f28d 100644
--- a/iotdb-protocol/thrift-datanode/src/main/thrift/datanode.thrift
+++ b/iotdb-protocol/thrift-datanode/src/main/thrift/datanode.thrift
@@ -783,12 +783,6 @@ struct TKillQueryInstanceReq {
   2: optional string allowedUsername
 }
 
-struct TReadObjectReq {
-  1: string relativePath
-  2: i64 offset
-  3: i32 size
-}
-
 /**
 * END: Used for EXPLAIN ANALYZE
 **/
@@ -1282,8 +1276,6 @@ service IDataNodeRPCService {
    * Write an audit log entry to the DataNode's AuditEventLogger
    */
   common.TSStatus writeAuditLog(TAuditLogReq req);
-
-  binary readObject(TReadObjectReq req);
 }
 
 service MPPDataExchangeService {

Reply via email to