Skip to content

Commit

Permalink
[fix][client] Fix SendBatchVectorAdd with no file input.
Browse files Browse the repository at this point in the history
Signed-off-by: Ketor <[email protected]>
  • Loading branch information
ketor authored and rock-git committed Mar 7, 2024
1 parent 925ee76 commit 9099b2e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/client/store_client_function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1683,14 +1683,20 @@ int SendBatchVectorAdd(int64_t region_id, uint32_t dimension, std::vector<int64_
dingodb::pb::index::VectorAddResponse response;

uint32_t max_size = 0;
if (vector_datas.size() > vector_datas_offset + vector_ids.size()) {
if (vector_datas.empty()) {
max_size = vector_ids.size();
} else {
max_size = vector_datas.size() > vector_datas_offset ? vector_datas.size() - vector_datas_offset : 0;
if (vector_datas.size() > vector_datas_offset + vector_ids.size()) {
max_size = vector_ids.size();
} else {
max_size = vector_datas.size() > vector_datas_offset ? vector_datas.size() - vector_datas_offset : 0;
}
}

if (max_size == 0) {
DINGO_LOG(INFO) << "vector_datas.size() - vector_datas_offset <= vector_ids.size(), max_size: " << max_size;
DINGO_LOG(INFO) << "vector_datas.size() - vector_datas_offset <= vector_ids.size(), max_size: " << max_size
<< ", vector_datas.size: " << vector_datas.size()
<< ", vector_datas_offset: " << vector_datas_offset << ", vector_ids.size: " << vector_ids.size();
return 0;
} else {
DINGO_LOG(DEBUG) << "vector_datas.size(): " << vector_datas.size()
Expand Down

0 comments on commit 9099b2e

Please sign in to comment.