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

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

commit af4b15d618f37233ba56e69ee1b7d1f10bc97e5d
Author: JackieTien97 <[email protected]>
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());
     }

Reply via email to