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

JackieTien97 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 0594afc33a8 fix the table function that has scalar argument of null 
value (#18714)
0594afc33a8 is described below

commit 0594afc33a8c3e18eb115cdb26b31b55df4f1840
Author: alpass163 <[email protected]>
AuthorDate: Thu Sep 24 13:04:25 2026 +0800

    fix the table function that has scalar argument of null value (#18714)
---
 .../org/apache/iotdb/relational/it/db/it/IoTDBWindowTVFIT.java   | 9 +++++++++
 .../i18n/en/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java  | 1 +
 .../i18n/zh/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java  | 1 +
 .../queryengine/plan/relational/analyzer/StatementAnalyzer.java  | 7 ++++++-
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBWindowTVFIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBWindowTVFIT.java
index a225039b474..a5dfe498f4f 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBWindowTVFIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBWindowTVFIT.java
@@ -1425,6 +1425,15 @@ public class IoTDBWindowTVFIT {
         DATABASE_NAME);
   }
 
+  @Test
+  public void testLowPassWithNullArgument() {
+    tableAssertTestFail(
+        "SELECT * FROM LOWPASS(DATA => (SELECT time, device_id, s3 FROM 
table1) "
+            + "PARTITION BY device_id ORDER BY time, TIMECOL => 'time', WPASS 
=> null)",
+        "701: The parameter WPASS cannot be actively filled with null.",
+        DATABASE_NAME);
+  }
+
   @Test
   public void testHighWithOnePartition() {
     String[] expectedHeader = new String[] {"stock_id", "time", 
"highpass(price)", "highpass(s1)"};
diff --git 
a/iotdb-core/datanode/src/main/i18n/en/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java
 
b/iotdb-core/datanode/src/main/i18n/en/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java
index c40bea5a748..b2c6f4662fb 100644
--- 
a/iotdb-core/datanode/src/main/i18n/en/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java
+++ 
b/iotdb-core/datanode/src/main/i18n/en/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java
@@ -859,6 +859,7 @@ public final class DataNodeQueryMessages {
       "Duplicate argument name: %s";
   public static final String SETTING_MONTHLY_INTERVALS_IS_NOT_SUPPORTED =
       "Setting monthly intervals is not supported.";
+  public static final String THE_ARGUMENT_CANNOT_BE_NULL =  "The parameter %s 
cannot be actively filled with null.";
   public static final String FILTER_PUSH_DOWN_DOES_NOT_SUPPORT_CASE_WHEN =
       "Filter push down does not support CASE WHEN";
   public static final String FILTER_PUSH_DOWN_DOES_NOT_SUPPORT_IF =
diff --git 
a/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java
 
b/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java
index 8fe4ccb5937..849e726ccbb 100644
--- 
a/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java
+++ 
b/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeQueryMessages.java
@@ -839,6 +839,7 @@ public final class DataNodeQueryMessages {
       "重复的参数名:%s";
   public static final String SETTING_MONTHLY_INTERVALS_IS_NOT_SUPPORTED =
       "不支持设置按月间隔。";
+  public static final String THE_ARGUMENT_CANNOT_BE_NULL =  "参数 %s 不能主动填null值";
   public static final String FILTER_PUSH_DOWN_DOES_NOT_SUPPORT_CASE_WHEN =
       "过滤下推不支持 CASE WHEN";
   public static final String FILTER_PUSH_DOWN_DOES_NOT_SUPPORT_IF =
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java
index 777e0de391a..bd985e89701 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java
@@ -6404,11 +6404,16 @@ public class StatementAnalyzer {
               
DataNodeQueryMessages.SETTING_MONTHLY_INTERVALS_IS_NOT_SUPPORTED);
         }
       }
-
       // currently, only constant arguments are supported
       Object constantValue =
           evaluateConstantExpression(
               expression, new PlannerContext(metadata, typeManager), 
sessionContext);
+      if (constantValue == null) {
+        throw new SemanticException(
+            String.format(
+                DataNodeQueryMessages.THE_ARGUMENT_CANNOT_BE_NULL,
+                argumentSpecification.getName()));
+      }
       if (!argumentSpecification.getType().checkObjectType(constantValue)) {
         if 
((argumentSpecification.getType().equals(org.apache.iotdb.udf.api.type.Type.STRING)
                 || 
argumentSpecification.getType().equals(org.apache.iotdb.udf.api.type.Type.TEXT))

Reply via email to