hongzhi-gao commented on code in PR #745:
URL: https://github.com/apache/tsfile/pull/745#discussion_r2980705799
##########
cpp/src/reader/qds_without_timegenerator.cc:
##########
@@ -111,37 +143,111 @@ void QDSWithoutTimeGenerator::close() {
}
int QDSWithoutTimeGenerator::next(bool& has_next) {
- row_record_->reset();
- if (heap_time_.size() == 0) {
- has_next = false;
- return E_OK;
+ // For single path, apply offset/limit at row level.
+ if (is_single_path_) {
+ while (true) {
+ row_record_->reset();
+ if (heap_time_.size() == 0) {
+ has_next = false;
+ return E_OK;
+ }
+ if (remaining_limit_ == 0) {
+ has_next = false;
+ return E_OK;
+ }
+ int64_t time = heap_time_.begin()->first;
+ row_record_->set_timestamp(time);
+ row_record_->get_field(0)->set_value(INT64, &time, get_len(INT64),
+ pa_);
+
+ uint32_t len = 0;
+ uint32_t idx = heap_time_.begin()->second;
+ auto val_datatype = value_iters_[idx]->get_data_type();
+ void* val_ptr = value_iters_[idx]->read(&len);
+ row_record_->get_field(idx + 1)->set_value(val_datatype, val_ptr,
+ len, pa_);
+ value_iters_[idx]->next();
+
+ heap_time_.erase(heap_time_.begin());
+
+ if (!time_iters_[idx]->end()) {
+ int64_t timev = *(int64_t*)(time_iters_[idx]->read(&len));
+ heap_time_.insert(std::make_pair(timev, idx));
+ time_iters_[idx]->next();
+ } else {
+ get_next_tsblock(idx, false);
+ }
+
+ // Apply offset: skip this row.
+ if (remaining_offset_ > 0) {
+ remaining_offset_--;
+ continue;
+ }
Review Comment:
I updated the flow to skip populating row_record fields when offset is still
pending, while still advancing iterators/heap state correctly.
--
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]