Skip to content

fix: fail to get empty index num rows #39155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions internal/core/src/index/ScalarIndexSort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,14 @@
auto index_data = index_binary.GetByName("index_data");
data_.resize(index_size);
auto index_num_rows = index_binary.GetByName("index_num_rows");
memcpy(&total_num_rows_,
index_num_rows->data.get(),
(size_t)index_num_rows->size);
if (index_num_rows) {
memcpy(&total_num_rows_,
index_num_rows->data.get(),
(size_t)index_num_rows->size);
} else {
total_num_rows_ = index_size;

Check warning on line 184 in internal/core/src/index/ScalarIndexSort.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/index/ScalarIndexSort.cpp#L184

Added line #L184 was not covered by tests
}

idx_to_offsets_.resize(total_num_rows_);
valid_bitset_ = TargetBitmap(total_num_rows_, false);
memcpy(data_.data(), index_data->data.get(), (size_t)index_data->size);
Expand Down
Loading