diff --git a/internal/core/src/exec/expression/Expr.h b/internal/core/src/exec/expression/Expr.h index a5f90c6462..b3ca548660 100644 --- a/internal/core/src/exec/expression/Expr.h +++ b/internal/core/src/exec/expression/Expr.h @@ -350,6 +350,8 @@ class SegmentExpr : public Expr { Assert(num_data_chunk_ == 1); auto need_size = std::min(active_count_ - current_data_chunk_pos_, batch_size_); + if (need_size == 0) + return 0; //do not go empty-loop at the bound of the chunk auto& skip_index = segment_->GetSkipIndex(); auto views_info = segment_->get_batch_views( @@ -670,6 +672,8 @@ class SegmentExpr : public Expr { : size_per_chunk_ - data_pos; size = std::min(size, batch_size_ - processed_size); + if (size == 0) + continue; //do not go empty-loop at the bound of the chunk auto& skip_index = segment_->GetSkipIndex(); auto chunk = segment_->chunk_data(field_id_, i);