gongning created IOTDB-2936:
-------------------------------
Summary: The serialization type uses the enumeration ordinal,
which can easily cause deserialization failures if the order of the enumeration
objects changes.
Key: IOTDB-2936
URL: https://issues.apache.org/jira/browse/IOTDB-2936
Project: Apache IoTDB
Issue Type: Improvement
Components: Core/Engine
Reporter: gongning
The serialization type uses the enumeration ordinal, which can easily cause
deserialization failures if the order of the enumeration objects changes.
Therefore, the constant value int should be used for each type
eg:
@Override
public void serializeImpl(ByteBuffer buffer) {
int type = PhysicalPlanType.INSERT.ordinal();
buffer.put((byte) type);
subSerialize(buffer);
}
@Override
public void serializeImpl(ByteBuffer buffer) {
int type = PhysicalPlanType.BATCHINSERT.ordinal();
buffer.put((byte) type);
subSerialize(buffer, 0, rowCount);
}
Improvement:
@Override
public void serializeImpl(ByteBuffer buffer) {
int type = PhysicalPlanType.INSERT.type;
buffer.put((byte) type);
subSerialize(buffer);
}
@Override
public void serializeImpl(ByteBuffer buffer) {
int type = PhysicalPlanType.BATCHINSERT.type;
buffer.put((byte) type);
subSerialize(buffer, 0, rowCount);
}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)