diff --git a/server/src/main/java/org/apache/iotdb/db/query/udf/api/AbstractUDFRegister.java b/server/src/main/java/org/apache/iotdb/db/query/udf/api/AbstractUDFRegister.java new file mode 100644 index 000000000000..cb261858d82e --- /dev/null +++ b/server/src/main/java/org/apache/iotdb/db/query/udf/api/AbstractUDFRegister.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.iotdb.db.query.udf.api; + +public abstract class AbstractUDFRegister { + private String language; + + abstract void register(String functionName, String className, boolean writeToTemporaryLogFile); + + abstract void deregister(String functionName); +} diff --git a/server/src/main/java/org/apache/iotdb/db/query/udf/api/UDFExecutorInterface.java b/server/src/main/java/org/apache/iotdb/db/query/udf/api/UDFExecutorInterface.java new file mode 100644 index 000000000000..5f9b6e3bb413 --- /dev/null +++ b/server/src/main/java/org/apache/iotdb/db/query/udf/api/UDFExecutorInterface.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.iotdb.db.query.udf.api; + +import org.apache.iotdb.db.exception.query.QueryProcessException; +import org.apache.iotdb.db.query.expression.Expression; +import org.apache.iotdb.db.query.udf.api.access.Row; +import org.apache.iotdb.db.query.udf.api.access.RowWindow; +import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType; + +import java.util.Map; + +public interface UDFExecutorInterface { + void beforeStart( + long queryId, + float collectorMemoryBudgetInMB, + Map expressionDataTypeMap) + throws QueryProcessException; + + void execute(Row row, boolean isCurrentRowNull) throws QueryProcessException; + + void execute(RowWindow rowWindow) throws QueryProcessException; + + void terminate() throws QueryProcessException; + void beforeDestroy(); + + + +} diff --git a/server/src/main/java/org/apache/iotdb/db/query/udf/service/UDFManagementService.java b/server/src/main/java/org/apache/iotdb/db/query/udf/service/UDFManagementService.java new file mode 100644 index 000000000000..514fd70580f7 --- /dev/null +++ b/server/src/main/java/org/apache/iotdb/db/query/udf/service/UDFManagementService.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.iotdb.db.query.udf.service; + +import org.apache.iotdb.commons.exception.StartupException; +import org.apache.iotdb.commons.service.IService; +import org.apache.iotdb.commons.service.ServiceType; +import org.apache.iotdb.db.query.udf.api.UDFExecutorInterface; + +import java.util.concurrent.ConcurrentHashMap; + +public class UDFManagementService implements IService { + private ConcurrentHashMap registrationInformation; + private ConcurrentHashMap udfExecutors; + + @Override + public void start() throws StartupException { + + } + + @Override + public void stop() { + + } + + @Override + public ServiceType getID() { + return null; + } +}