This is an automated email from the ASF dual-hosted git repository.
jackietien 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 c215fef2acc Fix table model UDF can be invoked after dropped.
c215fef2acc is described below
commit c215fef2accf9348a0efa5516031b2e5d0f907b3
Author: Chen YZ <[email protected]>
AuthorDate: Sat Mar 22 08:28:27 2025 +0800
Fix table model UDF can be invoked after dropped.
---
.../it/db/it/udf/IoTDBUserDefinedAggregateFunctionIT.java | 9 +++++++--
.../apache/iotdb/commons/udf/service/UDFManagementService.java | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedAggregateFunctionIT.java
b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedAggregateFunctionIT.java
index 5cdb082d0d7..0bc25656eea 100644
---
a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedAggregateFunctionIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedAggregateFunctionIT.java
@@ -119,8 +119,6 @@ public class IoTDBUserDefinedAggregateFunctionIT {
public static void setUp() throws Exception {
EnvFactory.getEnv().initClusterEnvironment();
insertData();
- SQLFunctionUtils.createUDF(
- "my_count",
"org.apache.iotdb.db.query.udf.example.relational.MyCount");
}
@AfterClass
@@ -147,6 +145,8 @@ public class IoTDBUserDefinedAggregateFunctionIT {
@Test
public void testMyCount() {
+ SQLFunctionUtils.createUDF(
+ "my_count",
"org.apache.iotdb.db.query.udf.example.relational.MyCount");
String[] expectedHeader = new String[] {"_col0"};
String[] retArray =
new String[] {
@@ -449,6 +449,9 @@ public class IoTDBUserDefinedAggregateFunctionIT {
};
tableResultSetEqualTest(
"select my_count(time) from table1", expectedHeader, retArray,
DATABASE_NAME);
+ // drop function and invoke
+ dropFunction();
+ tableAssertTestFail("select my_count(time) from table1", "Unknown
function", DATABASE_NAME);
}
@Test
@@ -690,6 +693,8 @@ public class IoTDBUserDefinedAggregateFunctionIT {
@Test
public void testDistinct() {
+ SQLFunctionUtils.createUDF(
+ "my_count",
"org.apache.iotdb.db.query.udf.example.relational.MyCount");
String[] expectedHeader =
new String[] {
"_col0", "_col1", "_col2", "_col3", "_col4", "_col5", "_col6",
"_col7", "_col8", "_col9",
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFManagementService.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFManagementService.java
index fe62cb4d291..e5a9ff6bd20 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFManagementService.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFManagementService.java
@@ -205,7 +205,7 @@ public class UDFManagementService {
throws Exception {
try {
acquireLock();
- UDFInformation information = udfTable.getUDFInformation(Model.TREE,
functionName);
+ UDFInformation information = udfTable.getUDFInformation(model,
functionName);
if (information == null) {
return;
}