HeimingZ commented on code in PR #7290:
URL: https://github.com/apache/iotdb/pull/7290#discussion_r969210078


##########
server/src/main/java/org/apache/iotdb/db/utils/datastructure/BinaryTVList.java:
##########
@@ -46,6 +49,42 @@ public abstract class BinaryTVList extends TVList {
     values = new ArrayList<>();
   }
 
+  public static BinaryTVList newList() {
+    if (TVLIST_SORT_ALGORITHM == 1) {
+      return new QuickBinaryTVList();
+    }
+    return new TimBinaryTVList();
+  }
+
+  public static BinaryTVList deserialize(DataInputStream stream) throws 
IOException {
+    BinaryTVList tvList = BinaryTVList.newList();
+    int rowCount = stream.readInt();
+    long[] times = new long[rowCount];
+    Binary[] values = new Binary[rowCount];
+    for (int rowIdx = 0; rowIdx < rowCount; ++rowIdx) {
+      times[rowIdx] = stream.readLong();
+      values[rowIdx] = ReadWriteIOUtils.readBinary(stream);
+    }
+    tvList.putBinaries(times, values, null, 0, rowCount);
+    return tvList;
+  }

Review Comment:
   If user uses tim sort to serialize and uses quick sort to deserialize, this 
deserialization method will throw an exception. We should serialize sort type 
and choose different implementations when deserializing.



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

Reply via email to