disable object type in UDTF
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 8770ed2..22cc5df 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.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_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 @@ + "'.", 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 @@ 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 6a2b7eb..01b216f 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.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 @@ 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