Copilot commented on code in PR #16576:
URL: https://github.com/apache/iotdb/pull/16576#discussion_r2435586385


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java:
##########
@@ -1875,13 +1875,16 @@ public boolean hasNextBatch() {
 
     @Override
     public TsBlock nextBatch() {
-      TsBlockBuilder builder = new TsBlockBuilder(maxNumberOfPointsInPage, 
dataTypeList);
+      int maxRowCountOfCurrentBatch = Math.min(rows - index, 
maxNumberOfPointsInPage);
+      TsBlockBuilder builder = new TsBlockBuilder(maxRowCountOfCurrentBatch, 
dataTypeList);
       // Time column
       TimeColumnBuilder timeBuilder = builder.getTimeColumnBuilder();
 
       int validRowCount = 0;
-      // duplicated time or deleted time are all invalid, true if we don't 
need this row
-      BitMap timeInvalidInfo = null;
+      // deleted row or time that do not match the filter are all invalid, true
+      // if we don't need this row

Review Comment:
   [nitpick] Corrected spelling of 'deleted' (was 'deleted' in original, which 
is correct). Actually, reviewing more carefully, the comment grammar is 
awkward. The phrase "true if we don't need this row" should be part of a 
complete sentence or clarified.
   ```suggestion
         // Rows that are deleted or whose timestamps do not match the filter 
are considered invalid.
         // The corresponding bit is set to true if the row is not needed.
   ```



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java:
##########
@@ -1891,34 +1894,47 @@ public TsBlock nextBatch() {
         if (validRowCount >= maxNumberOfPointsInPage || 
isCurrentTimeExceedTimeRange(time)) {
           break;
         }
-        // skip empty row
-        if (allValueColDeletedMap != null
-            && 
allValueColDeletedMap.isMarked(getValueIndex(getScanOrderIndex(index)))) {
-          continue;
-        }
-        if (isTimeDeleted(getScanOrderIndex(index)) || !isTimeSatisfied(time)) 
{
+        // skip invalid row
+        if ((allValueColDeletedMap != null
+                && 
allValueColDeletedMap.isMarked(getValueIndex(getScanOrderIndex(index))))
+            || isTimeDeleted(getScanOrderIndex(index))
+            || !isTimeSatisfied(time)
+            || isPointDeleted(time, timeColumnDeletion, deleteCursor, 
scanOrder)) {
+          timeInvalidInfo =
+              timeInvalidInfo == null
+                  ? new LazyBitMap(index, maxRowCountOfCurrentBatch, rows - 1)
+                  : timeInvalidInfo;
+          timeInvalidInfo.mark(index);
           continue;
         }
         int nextRowIndex = index + 1;
+        long timeOfNextRowIndex;
         while (nextRowIndex < rows
             && ((allValueColDeletedMap != null
                     && allValueColDeletedMap.isMarked(
                         getValueIndex(getScanOrderIndex(nextRowIndex))))
-                || (isTimeDeleted(getScanOrderIndex(nextRowIndex)) || 
!isTimeSatisfied(time)))) {
+                || isTimeDeleted(getScanOrderIndex(nextRowIndex))
+                || !isTimeSatisfied((timeOfNextRowIndex = 
getTime(getScanOrderIndex(nextRowIndex))))

Review Comment:
   [nitpick] Assignment inside the conditional expression reduces readability. 
Consider separating the assignment from the condition check for better clarity.



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