761417898 commented on code in PR #192:
URL: https://github.com/apache/tsfile/pull/192#discussion_r1727064225


##########
cpp/src/reader/tsfile_series_scan_iterator.cc:
##########
@@ -38,19 +42,34 @@ int TsFileSeriesScanIterator::get_next(TsBlock 
*&ret_tsblock, bool alloc,
     int ret = E_OK;
     Filter *filter =
         (oneshoot_filter != nullptr) ? oneshoot_filter : time_filter_;
-    if (!chunk_reader_.has_more_data()) {
+    if (!chunk_reader_->has_more_data()) {
         while (true) {
             if (!has_next_chunk()) {
                 return E_NO_MORE_DATA;
             } else {
-                advance_to_next_chunk();
-                ChunkMeta *cm = get_current_chunk_meta();
-                if (filter != nullptr && cm->statistic_ != nullptr &&
-                    !filter->satisfy(cm->statistic_)) {
-                    continue;
-                }
-                chunk_reader_.reset();
-                if (RET_FAIL(chunk_reader_.load_by_meta(cm))) {
+                if (!is_aligned_) {
+                    advance_to_next_chunk();
+                    ChunkMeta *cm = get_current_chunk_meta();
+                    if (filter != nullptr && cm->statistic_ != nullptr &&
+                        !filter->satisfy(cm->statistic_)) {
+                        continue;
+                    }
+                    chunk_reader_->reset();
+                    if (RET_FAIL(chunk_reader_->load_by_meta(cm))) {
+                    }
+                } else {
+                    ChunkMeta *time_cm = time_chunk_meta_cursor_.get();
+                    ChunkMeta *value_cm = value_chunk_meta_cursor_.get();
+                    advance_to_next_chunk();
+                    if (filter != nullptr && value_cm->statistic_ != nullptr &&
+                        !filter->satisfy(value_cm->statistic_)) {
+                        continue;
+                    }
+                    chunk_reader_->reset();
+                    if (RET_FAIL(chunk_reader_->load_by_aligned_meta(
+                            time_cm, value_cm))) {
+                    }
+                    break;
                 }

Review Comment:
   Fixed the bug that occurred when reading unaligned time series with multiple 
flushes.



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