You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2025/12/18 03:55:53 UTC

(iotdb) 31/33: Throw exception while readObject column is not OBJECT type

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

jackietien pushed a commit to branch force_ci/object_type
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit fb38bd938e3639adc547beddedbbea5693d658ee
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Mon Dec 15 18:10:14 2025 +0800

    Throw exception while readObject column is not OBJECT type
---
 .../execution/operator/process/function/partition/Slice.java           | 3 +++
 .../operator/source/relational/aggregation/RecordIterator.java         | 3 +++
 2 files changed, 6 insertions(+)

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 a34a0eb650d..57f04be9e00 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
@@ -221,6 +221,9 @@ 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());
     }
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 ae66a11729d..234723b229b 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
@@ -166,6 +166,9 @@ 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());
     }