This is an automated email from the ASF dual-hosted git repository. yongzao pushed a commit to branch fix-call-inference-error in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit dea9af5110374701d9629e3e630f98b21371ea5b Author: Yongzao <[email protected]> AuthorDate: Tue Mar 17 20:30:57 2026 +0800 finish --- .../iotdb/commons/model/ModelInformation.java | 61 ++-------------------- .../org/apache/iotdb/commons/model/ModelType.java | 26 --------- 2 files changed, 5 insertions(+), 82 deletions(-) diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelInformation.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelInformation.java index 01968833db7..160af89615c 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelInformation.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelInformation.java @@ -24,7 +24,6 @@ import org.apache.tsfile.utils.PublicBAOS; import org.apache.tsfile.utils.ReadWriteIOUtils; import java.io.DataOutputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; @@ -35,8 +34,6 @@ public class ModelInformation { private static final int[] DEFAULT_MODEL_INPUT_SHAPE = new int[] {2880, 1}; private static final int[] DEFAULT_MODEL_OUTPUT_SHAPE = new int[] {720, 1}; - ModelType modelType; - private final String modelId; private final int[] inputShape; @@ -60,7 +57,6 @@ public class ModelInformation { } public ModelInformation( - ModelType modelType, String modelId, int[] inputShape, int[] outputShape, @@ -68,7 +64,6 @@ public class ModelInformation { TSDataType[] outputDataType, String attribute, ModelStatus status) { - this.modelType = modelType; this.modelId = modelId; this.inputShape = inputShape; this.outputShape = outputShape; @@ -85,7 +80,6 @@ public class ModelInformation { TSDataType[] inputDataType, TSDataType[] outputDataType, String attribute) { - this.modelType = ModelType.USER_DEFINED; this.modelId = modelId; this.inputShape = inputShape; this.outputShape = outputShape; @@ -95,7 +89,6 @@ public class ModelInformation { } public ModelInformation(String modelId, ModelStatus status) { - this.modelType = ModelType.BUILT_IN_FORECAST; this.modelId = modelId; this.inputShape = new int[0]; this.outputShape = new int[0]; @@ -104,21 +97,6 @@ public class ModelInformation { this.status = status; } - // init built-in modelInformation - public ModelInformation(ModelType modelType, String modelId) { - this.modelType = modelType; - this.modelId = modelId; - this.inputShape = new int[2]; - this.outputShape = new int[2]; - this.inputDataType = new TSDataType[0]; - this.outputDataType = new TSDataType[0]; - this.status = ModelStatus.ACTIVE; - } - - public boolean isBuiltIn() { - return modelType != ModelType.USER_DEFINED; - } - public boolean available() { return status == ModelStatus.ACTIVE; } @@ -139,26 +117,6 @@ public class ModelInformation { outputShape[0] = length; } - // calculation modelType and outputColumn metadata for different built-in models - public void setInputColumnSize(int size) { - inputShape[1] = size; - if (modelType == ModelType.BUILT_IN_FORECAST) { - outputShape[1] = size; - } else if (modelType == ModelType.BUILT_IN_ANOMALY_DETECTION) { - outputShape[1] = 1; - } else { - outputShape[1] = size; - } - if (modelType == ModelType.BUILT_IN_FORECAST) { - buildOutputDataTypeForBuiltInModel(TSDataType.DOUBLE, outputShape[1]); - } else if (modelType == ModelType.BUILT_IN_ANOMALY_DETECTION) { - buildOutputDataTypeForBuiltInModel(TSDataType.INT32, outputShape[1]); - } else { - buildOutputDataTypeForBuiltInModel(TSDataType.FLOAT, outputShape[1]); - buildInputDataTypeForBuiltInModel(TSDataType.FLOAT, inputShape[1]); - } - } - public void setInputDataType(TSDataType[] inputDataType) { this.inputDataType = inputDataType; } @@ -206,7 +164,6 @@ public class ModelInformation { } public void serialize(DataOutputStream stream) throws IOException { - ReadWriteIOUtils.write(modelType.ordinal(), stream); ReadWriteIOUtils.write(status.ordinal(), stream); ReadWriteIOUtils.write(modelId, stream); if (status == ModelStatus.UNAVAILABLE) { @@ -230,8 +187,7 @@ public class ModelInformation { ReadWriteIOUtils.write(attribute, stream); } - public void serialize(FileOutputStream stream) throws IOException { - ReadWriteIOUtils.write(modelType.ordinal(), stream); + public void serialize(FileOutputSecltream stream) throws IOException { ReadWriteIOUtils.write(status.ordinal(), stream); ReadWriteIOUtils.write(modelId, stream); if (status == ModelStatus.UNAVAILABLE) { @@ -256,7 +212,6 @@ public class ModelInformation { } public void serialize(ByteBuffer byteBuffer) { - ReadWriteIOUtils.write(modelType.ordinal(), byteBuffer); ReadWriteIOUtils.write(status.ordinal(), byteBuffer); ReadWriteIOUtils.write(modelId, byteBuffer); if (status == ModelStatus.UNAVAILABLE) { @@ -281,8 +236,7 @@ public class ModelInformation { } public static ModelInformation deserialize(ByteBuffer buffer) { - ModelType modelType = ModelType.values()[ReadWriteIOUtils.readInt(buffer)]; - ModelStatus status = ModelStatus.values()[ReadWriteIOUtils.readInt(buffer)]; + ModelStatus status = ModelStatus.values()[ReadWriteIOUtils.readInt(buffer)]; String modelName = ReadWriteIOUtils.readString(buffer); if (status == ModelStatus.UNAVAILABLE) { return new ModelInformation(modelName, status); @@ -311,8 +265,7 @@ public class ModelInformation { String attribute = ReadWriteIOUtils.readString(buffer); return new ModelInformation( - modelType, - modelName, + modelName, inputShape, outputShape, inputDataType, @@ -322,8 +275,7 @@ public class ModelInformation { } public static ModelInformation deserialize(InputStream stream) throws IOException { - ModelType modelType = ModelType.values()[ReadWriteIOUtils.readInt(stream)]; - ModelStatus status = ModelStatus.values()[ReadWriteIOUtils.readInt(stream)]; + ModelStatus status = ModelStatus.values()[ReadWriteIOUtils.readInt(stream)]; String modelName = ReadWriteIOUtils.readString(stream); if (status == ModelStatus.UNAVAILABLE) { return new ModelInformation(modelName, status); @@ -351,8 +303,7 @@ public class ModelInformation { String attribute = ReadWriteIOUtils.readString(stream); return new ModelInformation( - modelType, - modelName, + modelName, inputShape, outputShape, inputDataType, @@ -365,7 +316,6 @@ public class ModelInformation { PublicBAOS buffer = new PublicBAOS(); DataOutputStream stream = new DataOutputStream(buffer); ReadWriteIOUtils.write(modelId, stream); - ReadWriteIOUtils.write(modelType.toString(), stream); ReadWriteIOUtils.write(status.toString(), stream); ReadWriteIOUtils.write(Arrays.toString(inputShape), stream); ReadWriteIOUtils.write(Arrays.toString(outputShape), stream); @@ -382,7 +332,6 @@ public class ModelInformation { if (obj instanceof ModelInformation) { ModelInformation other = (ModelInformation) obj; return modelId.equals(other.modelId) - && modelType.equals(other.modelType) && Arrays.equals(inputShape, other.inputShape) && Arrays.equals(outputShape, other.outputShape) && Arrays.equals(inputDataType, other.inputDataType) diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelType.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelType.java deleted file mode 100644 index cd154748f23..00000000000 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.commons.model; - -public enum ModelType { - BUILT_IN_FORECAST, - BUILT_IN_ANOMALY_DETECTION, - USER_DEFINED -}
