jt2594838 commented on a change in pull request #464: Modified Decoder and
SequenceReader to support old version of TsFile
URL: https://github.com/apache/incubator-iotdb/pull/464#discussion_r336980811
##########
File path:
tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/PlainDecoder.java
##########
@@ -54,26 +55,55 @@ public boolean readBoolean(ByteBuffer buffer) {
@Override
public short readShort(ByteBuffer buffer) {
+ if (this.endianType == EndianType.LITTLE_ENDIAN) {
+ int ch1 = ReadWriteIOUtils.read(buffer);
+ int ch2 = ReadWriteIOUtils.read(buffer);
+ return (short) (ch1 + (ch2 << 8));
+ }
return buffer.getShort();
Review comment:
A better way would be setting the endian of the buffer using
`byteBuffer.order()` when the buffer is created, which can avoid many redundant
checks.
Notice: ByteBuffers get from methods like `byteBuffer.slice()` do not
inherit the byte order, so you have to set byte order for those ByteBuffers.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services