You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2024/11/04 09:46:45 UTC

(iotdb) branch master updated: AINode: Fix built-model inference error (#13985)

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

rong 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 be720d280d4 AINode: Fix built-model inference error (#13985)
be720d280d4 is described below

commit be720d280d4ef64a600a318bb5f5eac518f5e6d3
Author: YangCaiyin <yc...@gmail.com>
AuthorDate: Mon Nov 4 17:46:38 2024 +0800

    AINode: Fix built-model inference error (#13985)
---
 .../test/java/org/apache/iotdb/ainode/it/AINodeBasicIT.java | 13 +++++++++++++
 .../ainode/iotdb/ainode/model/built_in_model_factory.py     |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeBasicIT.java b/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeBasicIT.java
index 17404a50e9d..0306b1a5225 100644
--- a/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeBasicIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeBasicIT.java
@@ -179,6 +179,8 @@ public class AINodeBasicIT {
   public void callInferenceTest() {
     String sql = "CALL INFERENCE(identity, \"select s0,s1,s2 from root.AI.data\")";
     String sql2 = "CALL INFERENCE(identity, \"select s2,s0,s1 from root.AI.data\")";
+    String sql3 =
+        "CALL INFERENCE(_NaiveForecaster, \"select s0 from root.AI.data\", predict_length=3)";
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
 
@@ -215,6 +217,17 @@ public class AINodeBasicIT {
         }
         assertEquals(7, count);
       }
+
+      try (ResultSet resultSet = statement.executeQuery(sql3)) {
+        ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
+        checkHeader(resultSetMetaData, "output0,output1,output2");
+        int count = 0;
+        while (resultSet.next()) {
+          count++;
+        }
+        assertEquals(3, count);
+      }
+
     } catch (SQLException e) {
       fail(e.getMessage());
     }
diff --git a/iotdb-core/ainode/iotdb/ainode/model/built_in_model_factory.py b/iotdb-core/ainode/iotdb/ainode/model/built_in_model_factory.py
index 3854ba4e367..82443012176 100644
--- a/iotdb-core/ainode/iotdb/ainode/model/built_in_model_factory.py
+++ b/iotdb-core/ainode/iotdb/ainode/model/built_in_model_factory.py
@@ -99,7 +99,7 @@ def fetch_built_in_model(model_id, inference_attributes):
     else:
         raise BuiltInModelNotSupportError(model_id)
 
-    return model, attributes
+    return model
 
 
 class Attribute(object):