fix: [2.5] Skip empty loop for process growing segment (#44608)

issue: #43427 
master pr: #44606 

The GISFunction asserts that the segment_offsets cannot be nullptr. When
size is 0, the segment_offsets is nullptr, so the loop is skiped.

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
cai.zhang 2025-10-10 14:55:59 +08:00 committed by GitHub
parent 7f52c02871
commit 52ab33ba88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -350,6 +350,8 @@ class SegmentExpr : public Expr {
Assert(num_data_chunk_ == 1); Assert(num_data_chunk_ == 1);
auto need_size = auto need_size =
std::min(active_count_ - current_data_chunk_pos_, batch_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& skip_index = segment_->GetSkipIndex();
auto views_info = segment_->get_batch_views<T>( auto views_info = segment_->get_batch_views<T>(
@ -670,6 +672,8 @@ class SegmentExpr : public Expr {
: size_per_chunk_ - data_pos; : size_per_chunk_ - data_pos;
size = std::min(size, batch_size_ - processed_size); 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& skip_index = segment_->GetSkipIndex();
auto chunk = segment_->chunk_data<T>(field_id_, i); auto chunk = segment_->chunk_data<T>(field_id_, i);