wshao08 commented on a change in pull request #1400:
URL: https://github.com/apache/incubator-iotdb/pull/1400#discussion_r451304753



##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
##########
@@ -203,38 +204,40 @@ public ReadOnlyMemChunk query(String deviceId, String 
measurement, TSDataType da
     if (!checkPath(deviceId, measurement)) {
       return null;
     }
-    long undeletedTime = findUndeletedTime(deviceId, measurement, 
timeLowerBound);
+    List<Pair<Long, Long>> deletionList = constructDeletionList(deviceId, 
measurement, timeLowerBound);
     IWritableMemChunk memChunk = memTableMap.get(deviceId).get(measurement);
     TVList chunkCopy = memChunk.getTVList().clone();
 
-    chunkCopy.setTimeOffset(undeletedTime);
+    chunkCopy.setDeletionList(deletionList);
     return new ReadOnlyMemChunk(measurement, dataType, encoding, chunkCopy, 
props, getVersion());
   }
 
 
-  private long findUndeletedTime(String deviceId, String measurement, long 
timeLowerBound) {
-    long undeletedTime = Long.MIN_VALUE;
+  private List<Pair<Long, Long>> constructDeletionList(String deviceId, String 
measurement,
+      long timeLowerBound) {
+    List<Pair<Long, Long>> deletionList = new ArrayList<>();
     for (Modification modification : modifications) {
       if (modification instanceof Deletion) {
         Deletion deletion = (Deletion) modification;
         if (deletion.getDevice().equals(deviceId) && 
deletion.getMeasurement().equals(measurement)
-            && deletion.getTimestamp() > undeletedTime) {
-          undeletedTime = deletion.getTimestamp();
+            && deletion.getEndTime() > timeLowerBound) {
+          long lowerBound = Math.max(deletion.getStartTime(), timeLowerBound);
+          deletionList.add(new Pair<>(lowerBound, deletion.getEndTime()));

Review comment:
       Fixed

##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/modification/Deletion.java
##########
@@ -28,21 +28,36 @@
 public class Deletion extends Modification {
 
   /**
-   * data whose timestamp <= this field are to be deleted.
+   * data within the interval [startTime, endTime] are to be deleted.
    */
-  private long timestamp;
+  private long startTime;
+  private long endTime;
 
-  public Deletion(Path path, long versionNum, long timestamp) {
+  public Deletion(Path path, long versionNum, long endTime) {
     super(Type.DELETION, path, versionNum);
-    this.timestamp = timestamp;
+    this.endTime = endTime;

Review comment:
       Fixed




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to