You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2019/12/04 08:45:25 UTC

[GitHub] [incubator-iotdb] LeiRui commented on a change in pull request #614: [IOTDB-306] new reader with ChunkMetaData for aggregateFunction

LeiRui commented on a change in pull request #614: [IOTDB-306] new reader with ChunkMetaData for aggregateFunction
URL: https://github.com/apache/incubator-iotdb/pull/614#discussion_r353610136
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/query/executor/AggregateEngineExecutor.java
 ##########
 @@ -212,40 +214,49 @@ private AggreResultData handleLastMaxTimeWithOutTimeGenerator(AggregateFunction
       throws IOException, QueryProcessException {
     long lastBatchTimeStamp = Long.MIN_VALUE;
     boolean isChunkEnd = false;
-    while (sequenceReader.hasNext()) {
-      PageHeader pageHeader = sequenceReader.nextPageHeader();
-      // judge if overlap with unsequence data
-      if (canUseHeader(function, pageHeader, unSequenceReader, timeFilter)) {
-        // cal by pageHeader
-        function.calculateValueFromPageHeader(pageHeader);
-        sequenceReader.skipPageData();
-
-        if (lastBatchTimeStamp > pageHeader.getStartTime()) {
-          // the chunk is end.
-          isChunkEnd = true;
-        } else {
-          // current page and last page are in the same chunk.
-          lastBatchTimeStamp = pageHeader.getStartTime();
-        }
-      } else {
-        // cal by pageData
-        BatchData batchData = sequenceReader.nextBatch();
-        if (batchData.length() > 0) {
-          if (lastBatchTimeStamp > batchData.currentTime()) {
+    while (sequenceReader.hasNextChunk()) {
+      ChunkMetaData chunkMetaData = sequenceReader.nextChunkMeta();
+      if (chunkMetaData != null && canUseHeader(function, chunkMetaData.getStartTime(),
+          chunkMetaData.getEndTime(), unSequenceReader, timeFilter)) {
+        function.calculateValueFromChunkMetaData(chunkMetaData);
+        continue;
 
 Review comment:
   The `if (isChunkEnd) {break;}` logic is missing here. You could have broken out of the loop early.

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


With regards,
Apache Git Services