This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch new_object_type
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/new_object_type by this push:
new 25082b21bf5 disable object type in UDTF
25082b21bf5 is described below
commit 25082b21bf58a9146bfff26969a801f59f2c9fcb
Author: JackieTien97 <[email protected]>
AuthorDate: Wed Nov 5 18:41:42 2025 +0800
disable object type in UDTF
---
.../config/executor/ClusterConfigTaskExecutor.java | 21 +++++++++++++++++++++
.../plan/relational/analyzer/StatementAnalyzer.java | 15 ++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
index 8770ed2873c..22cc5dffc98 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
@@ -324,6 +324,7 @@ import
org.apache.iotdb.udf.api.relational.AggregateFunction;
import org.apache.iotdb.udf.api.relational.ScalarFunction;
import org.apache.iotdb.udf.api.relational.TableFunction;
import
org.apache.iotdb.udf.api.relational.table.specification.ParameterSpecification;
+import
org.apache.iotdb.udf.api.relational.table.specification.ScalarParameterSpecification;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.SettableFuture;
@@ -368,6 +369,7 @@ import static
org.apache.iotdb.commons.schema.SchemaConstant.ALL_MATCH_SCOPE;
import static org.apache.iotdb.commons.schema.SchemaConstant.ALL_RESULT_NODES;
import static
org.apache.iotdb.db.protocol.client.ConfigNodeClient.MSG_RECONNECTION_FAIL;
import static org.apache.iotdb.db.utils.constant.SqlConstant.ROOT;
+import static org.apache.iotdb.udf.api.type.Type.OBJECT;
public class ClusterConfigTaskExecutor implements IConfigTaskExecutor {
@@ -671,6 +673,16 @@ public class ClusterConfigTaskExecutor implements
IConfigTaskExecutor {
+ "'.",
TSStatusCode.UDF_LOAD_CLASS_ERROR.getStatusCode()));
return future;
+ } else if (checkObjectScalarParameter(specification)) {
+ future.setException(
+ new IoTDBException(
+ "Failed to create function '"
+ + udfName
+ + "', because there is an argument with OBJECT
type '"
+ + specification.getName()
+ + "'.",
+ TSStatusCode.UDF_LOAD_CLASS_ERROR.getStatusCode()));
+ return future;
}
}
}
@@ -714,6 +726,15 @@ public class ClusterConfigTaskExecutor implements
IConfigTaskExecutor {
return future;
}
+ private boolean checkObjectScalarParameter(ParameterSpecification
parameterSpecification) {
+ if (parameterSpecification instanceof ScalarParameterSpecification) {
+ ScalarParameterSpecification scalarParameterSpecification =
+ (ScalarParameterSpecification) parameterSpecification;
+ return scalarParameterSpecification.getType() == OBJECT;
+ }
+ return false;
+ }
+
@Override
public SettableFuture<ConfigTaskResult> dropFunction(Model model, String
udfName) {
SettableFuture<ConfigTaskResult> future = SettableFuture.create();
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 6a2b7eb34c1..01b216fe875 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
@@ -221,6 +221,7 @@ import com.google.common.collect.ListMultimap;
import com.google.common.collect.Streams;
import org.apache.tsfile.common.conf.TSFileConfig;
import org.apache.tsfile.read.common.type.BinaryType;
+import org.apache.tsfile.read.common.type.ObjectType;
import org.apache.tsfile.read.common.type.RowType;
import org.apache.tsfile.read.common.type.StringType;
import org.apache.tsfile.read.common.type.TimestampType;
@@ -4753,11 +4754,15 @@ public class StatementAnalyzer {
i ->
i.getFields().stream()
.map(
- f ->
- Field.newUnqualified(
- f.getName(),
-
UDFDataTypeTransformer.transformUDFDataTypeToReadType(f.getType()),
- TsTableColumnCategory.FIELD))
+ f -> {
+ Type type =
+
UDFDataTypeTransformer.transformUDFDataTypeToReadType(f.getType());
+ if (type == ObjectType.OBJECT) {
+ throw new SemanticException(
+ "OBJECT type is not supported as return type");
+ }
+ return Field.newUnqualified(f.getName(), type,
TsTableColumnCategory.FIELD);
+ })
.forEach(fields::add));
// next, columns derived from table arguments, in order of argument
declarations