Re: I submitted an physical plan serialization issue【 IOTDB-2936】

2022-04-30 Thread Xiangdong Huang
I add an easy-fix label on the issue.
Welcome to contribute it.
Best,
---
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


苏志 <273670...@qq.com.invalid> 于2022年4月24日周日 15:12写道:

> 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); }
>
>
>
> Best,
> 
> gongning
>
>
>
>
>
> 


I submitted an physical plan serialization issue?? IOTDB-2936??

2022-04-24 Thread ????
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); }



Best,

gongning