HTHou 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_r337007967
 
 

 ##########
 File path: 
tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsFileMetaData.java
 ##########
 @@ -150,9 +150,11 @@ public static TsFileMetaData deserializeFrom(ByteBuffer 
buffer) throws IOExcepti
 
     if (ReadWriteIOUtils.readIsNull(buffer)) {
       fileMetaData.createdBy = ReadWriteIOUtils.readString(buffer);
-    }
-    fileMetaData.totalChunkNum = ReadWriteIOUtils.readInt(buffer);
-    fileMetaData.invalidChunkNum = ReadWriteIOUtils.readInt(buffer);
+    }  
+    // if using v0.8.0 TsFile, use 0 to represent missing fields
+    fileMetaData.totalChunkNum = buffer == null ? 0 : 
ReadWriteIOUtils.readInt(buffer);
+    fileMetaData.invalidChunkNum = buffer == null ? 0 : 
ReadWriteIOUtils.readInt(buffer);
 
 Review comment:
   > Could this buffer really be null?
   
   
   Did you mean I should change `buffer == null`to 
`!ReadWriteIOUtils.readIsNull(buffer)` ?

----------------------------------------------------------------
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

Reply via email to