This is an automated email from the ASF dual-hosted git repository. JackieTien97 pushed a commit to branch rc/2.0.12 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 6bf9080d11136b9681aded882eb12d7d3f81bef3 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 cf5832c9aca..ddc74b21eb2 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 @@ -844,6 +844,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 b7d7bed5aa2..4813da9878a 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 @@ -825,6 +825,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 b5c394539f2..803928aa783 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 @@ -6388,11 +6388,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))
