Copilot commented on code in PR #16686:
URL: https://github.com/apache/iotdb/pull/16686#discussion_r2483320634
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ForecastTableFunction.java:
##########
@@ -149,9 +156,14 @@ public void deserialize(byte[] bytes) {
this.keepInput = ReadWriteIOUtils.readBoolean(buffer);
this.options = ReadWriteIOUtils.readMap(buffer);
int size = ReadWriteIOUtils.readInt(buffer);
- this.types = new ArrayList<>(size);
+ this.inputColumnTypes = new ArrayList<>(size);
+ for (int i = 0; i < size; i++) {
+
inputColumnTypes.add(Type.valueOf(ReadWriteIOUtils.readString(buffer)));
Review Comment:
Serialization/deserialization mismatch: In the serialize() method (line
130), `type.getType()` writes a byte value, but here the code attempts to
deserialize it as a String. This should use `ReadWriteIOUtils.readByte(buffer)`
to match the serialization format, similar to line 166 for
predicatedColumnTypes.
```suggestion
inputColumnTypes.add(Type.valueOf(ReadWriteIOUtils.readByte(buffer)));
```
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ForecastTableFunction.java:
##########
@@ -482,14 +506,22 @@ public ForecastDataProcessor(ForecastTableFunctionHandle
functionHandle) {
this.keepInput = functionHandle.keepInput;
this.options = functionHandle.options;
this.inputRecords = new LinkedList<>();
- this.resultColumnAppenderList = new
ArrayList<>(functionHandle.types.size());
- List<TSDataType> tsDataTypeList = new
ArrayList<>(functionHandle.types.size());
- for (Type type : functionHandle.types) {
+ List<TSDataType> inputTsDataTypeList =
+ new ArrayList<>(functionHandle.inputColumnTypes.size());
+ for (Type type : functionHandle.inputColumnTypes) {
+ // AINode currently only accept double input
+ inputTsDataTypeList.add(TSDataType.DOUBLE);
+ }
+ this.inputTsBlockBuilder = new TsBlockBuilder(inputTsDataTypeList);
+ this.inputColumnAppenderList = new
ArrayList<>(functionHandle.inputColumnTypes.size());
+ for (Type type : functionHandle.inputColumnTypes) {
Review Comment:
Variable 'Type type' is never read.
```suggestion
for (int i = 0; i < functionHandle.inputColumnTypes.size(); i++) {
// AINode currently only accept double input
inputTsDataTypeList.add(TSDataType.DOUBLE);
}
this.inputTsBlockBuilder = new TsBlockBuilder(inputTsDataTypeList);
this.inputColumnAppenderList = new
ArrayList<>(functionHandle.inputColumnTypes.size());
for (int i = 0; i < functionHandle.inputColumnTypes.size(); i++) {
```
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/function/tvf/ForecastTableFunction.java:
##########
@@ -482,14 +506,22 @@ public ForecastDataProcessor(ForecastTableFunctionHandle
functionHandle) {
this.keepInput = functionHandle.keepInput;
this.options = functionHandle.options;
this.inputRecords = new LinkedList<>();
- this.resultColumnAppenderList = new
ArrayList<>(functionHandle.types.size());
- List<TSDataType> tsDataTypeList = new
ArrayList<>(functionHandle.types.size());
- for (Type type : functionHandle.types) {
+ List<TSDataType> inputTsDataTypeList =
+ new ArrayList<>(functionHandle.inputColumnTypes.size());
+ for (Type type : functionHandle.inputColumnTypes) {
+ // AINode currently only accept double input
+ inputTsDataTypeList.add(TSDataType.DOUBLE);
+ }
+ this.inputTsBlockBuilder = new TsBlockBuilder(inputTsDataTypeList);
+ this.inputColumnAppenderList = new
ArrayList<>(functionHandle.inputColumnTypes.size());
+ for (Type type : functionHandle.inputColumnTypes) {
Review Comment:
Variable 'Type type' is never read.
```suggestion
for (int i = 0; i < functionHandle.inputColumnTypes.size(); i++) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]