Skip to content

Commit

Permalink
[Improvement](scan) use loop to instead recursion on Level1Iterator::…
Browse files Browse the repository at this point in the history
…_normal_next (apache#38005)

## Proposed changes
use loop to instead recursion on Level1Iterator::_normal_next
  • Loading branch information
BiteTheDDDDt authored Jul 19, 2024
1 parent 1e65c24 commit a5dd5a9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions be/src/vec/olap/vcollect_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,18 +857,18 @@ Status VCollectIterator::Level1Iterator::_merge_next(Block* block) {
Status VCollectIterator::Level1Iterator::_normal_next(Block* block) {
SCOPED_RAW_TIMER(&_reader->_stats.collect_iterator_normal_next_timer);
auto res = _cur_child->next(block);

while (res.is<END_OF_FILE>() && !_children.empty()) {
_cur_child = std::move(*(_children.begin()));
_children.pop_front();
res = _cur_child->next(block);
}

if (LIKELY(res.ok())) {
return Status::OK();
} else if (res.is<END_OF_FILE>()) {
// current child has been read, to read next
if (!_children.empty()) {
_cur_child = std::move(*(_children.begin()));
_children.pop_front();
return _normal_next(block);
} else {
_cur_child.reset();
return Status::Error<END_OF_FILE>("");
}
_cur_child.reset();
return Status::Error<END_OF_FILE>("");
} else {
_cur_child.reset();
LOG(WARNING) << "failed to get next from child, res=" << res;
Expand Down

0 comments on commit a5dd5a9

Please sign in to comment.