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

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

commit 3ea8572f4b2bbdd06a6ba231b2b00fa102e8b5f2
Author: JackieTien97 <[email protected]>
AuthorDate: Thu Jun 19 12:32:09 2025 +0800

    Opt error msg while time column is empty string
---
 .../relational/function/tvf/ForecastTableFunction.java   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ForecastTableFunction.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ForecastTableFunction.java
index 138f7d23825..cb81381a20c 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ForecastTableFunction.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ForecastTableFunction.java
@@ -306,6 +306,11 @@ public class ForecastTableFunction implements 
TableFunction {
     String timeColumn =
         (String) ((ScalarArgument) 
arguments.get(TIMECOL_PARAMETER_NAME)).getValue();
 
+    if (timeColumn == null || timeColumn.isEmpty()) {
+      throw new SemanticException(
+          String.format("%s should never be null or empty.", 
TIMECOL_PARAMETER_NAME));
+    }
+
     // predicated columns should never contain partition by columns and time 
column
     Set<String> excludedColumns = new HashSet<>(input.getPartitionBy());
     excludedColumns.add(timeColumn);
@@ -571,6 +576,7 @@ public class ForecastTableFunction implements TableFunction 
{
                 modelId, predicatedResult.getPositionCount(), outputLength),
             TSStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
       }
+
       for (int columnIndex = 1, size = predicatedResult.getValueColumnCount();
           columnIndex <= size;
           columnIndex++) {
@@ -628,7 +634,15 @@ public class ForecastTableFunction implements 
TableFunction {
         throw new IoTDBRuntimeException(message, resp.getStatus().getCode());
       }
 
-      return SERDE.deserialize(ByteBuffer.wrap(resp.getForecastResult()));
+      TsBlock res = 
SERDE.deserialize(ByteBuffer.wrap(resp.getForecastResult()));
+      if (res.getValueColumnCount() != inputData.getValueColumnCount()) {
+        throw new IoTDBRuntimeException(
+            String.format(
+                "Model %s output %s columns, doesn't equal to specified %s",
+                modelId, res.getValueColumnCount(), 
inputData.getValueColumnCount()),
+            TSStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
+      }
+      return res;
     }
   }
 

Reply via email to