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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7af34381397 [AINode] Fix AINode inference output type (#17766)
7af34381397 is described below

commit 7af343813975662bc065a1b1ebacc8580ba48a86
Author: Yongzao <[email protected]>
AuthorDate: Mon May 25 23:30:53 2026 +0800

    [AINode] Fix AINode inference output type (#17766)
---
 .../java/org/apache/iotdb/ainode/it/AINodeSharedClusterIT.java     | 5 +++++
 iotdb-core/ainode/iotdb/ainode/core/manager/inference_manager.py   | 7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeSharedClusterIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeSharedClusterIT.java
index 1686e916ff0..4ea2b4af41a 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeSharedClusterIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeSharedClusterIT.java
@@ -42,6 +42,7 @@ import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.sql.Types;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -271,8 +272,10 @@ public class AINodeSharedClusterIT {
       try (ResultSet resultSet = statement.executeQuery(callInferenceSQL)) {
         ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
         checkHeader(resultSetMetaData, "Time,output");
+        Assert.assertEquals(Types.DOUBLE, resultSetMetaData.getColumnType(2));
         int count = 0;
         while (resultSet.next()) {
+          resultSet.getDouble("output");
           count++;
         }
         Assert.assertEquals(DEFAULT_OUTPUT_LENGTH, count);
@@ -288,8 +291,10 @@ public class AINodeSharedClusterIT {
       try (ResultSet resultSet = statement.executeQuery(callInferenceSQL)) {
         ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
         checkHeader(resultSetMetaData, "output");
+        Assert.assertEquals(Types.DOUBLE, resultSetMetaData.getColumnType(1));
         int count = 0;
         while (resultSet.next()) {
+          resultSet.getDouble("output");
           count++;
         }
         Assert.assertTrue(count > 0);
diff --git a/iotdb-core/ainode/iotdb/ainode/core/manager/inference_manager.py 
b/iotdb-core/ainode/iotdb/ainode/core/manager/inference_manager.py
index 8dcf03627dd..1f1bd083f26 100644
--- a/iotdb-core/ainode/iotdb/ainode/core/manager/inference_manager.py
+++ b/iotdb-core/ainode/iotdb/ainode/core/manager/inference_manager.py
@@ -209,10 +209,11 @@ class InferenceManager:
                 logger.error("[Inference] Unsupported pipeline type.")
             outputs = inference_pipeline.postprocess(outputs, 
**inference_attrs)
 
-        # convert tensor into tsblock for the output in each batch
+        # DataNode currently exposes inference outputs as DOUBLE, so serialize 
the
+        # physical TsBlock column as double even when model tensors are 
float32.
         resp_list = []
-        for batch_idx, output in enumerate(outputs):
-            resp = convert_tensor_to_tsblock(output)
+        for output in outputs:
+            resp = convert_tensor_to_tsblock(output.to(dtype=torch.float64))
             resp_list.append(resp)
         return resp_list
 

Reply via email to