HTHou commented on a change in pull request #2306:
URL: https://github.com/apache/iotdb/pull/2306#discussion_r547613069
##########
File path:
server/src/main/java/org/apache/iotdb/db/engine/modification/io/LocalTextModificationAccessor.java
##########
@@ -127,33 +128,36 @@ private static String encodeDeletion(Deletion del) {
+ del.getStartTime() + SEPARATOR + del.getEndTime();
}
+ /**
+ * Decode a deletion record. E.g.
"DELETION,root.ln.wf01.wt01.temperature,111,100,300"
+ * the index of field endTimestamp is length - 1, startTimestamp is length -
2,
+ * versionNum is length - 3. Fields in index range [1, length -3) could all
belong
+ * to timeseries path in cases that the paths contain comma.
+ */
private static Deletion decodeDeletion(String[] fields) throws IOException {
- if (fields.length != 5 && fields.length != 4) {
- throw new IOException("Incorrect deletion fields number: " +
fields.length);
- }
-
- String path = fields[1];
+ int length = fields.length;
+ String path = "";
long versionNum;
- long startTimestamp = Long.MIN_VALUE;
+ long startTimestamp;
long endTimestamp;
+
+ try {
+ endTimestamp = Long.parseLong(fields[length - 1]);
+ startTimestamp = Long.parseLong(fields[length - 2]);
+ } catch (NumberFormatException e) {
+ throw new IOException("Invalid timestamp: " + e.getMessage());
+ }
try {
- versionNum = Long.parseLong(fields[2]);
+ versionNum = Long.parseLong(fields[length - 3]);
} catch (NumberFormatException e) {
throw new IOException("Invalid version number: " + fields[2]);
Review comment:
```suggestion
throw new IOException("Invalid version number: " + fields[length - 3]);
```
----------------------------------------------------------------
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]