Skip to content

Commit

Permalink
fix: fix ShowPartitions error, #246 (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
matrixji authored Jan 15, 2024
1 parent 0127694 commit daf51a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/impl/MilvusClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,12 @@ MilvusClientImpl::ShowPartitions(const std::string& collection_name, const std::
partitions_info.reserve(count);
}
for (int i = 0; i < count; ++i) {
int inmemory_percentage = 0;
if (response.inmemory_percentages_size() > i) {
inmemory_percentage = response.inmemory_percentages(i);
}
partitions_info.emplace_back(response.partition_names(i), response.partitionids(i),
response.created_timestamps(i), response.inmemory_percentages(i));
response.created_timestamps(i), inmemory_percentage);
}
};

Expand Down
5 changes: 5 additions & 0 deletions test/st/TestCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ TEST_P(MilvusServerTestCollection, CreateAndDeleteCollection) {
EXPECT_EQ(collection_infos.front().MemoryPercentage(), 0);
EXPECT_EQ(collection_infos.front().Name(), "Foo");

// test for https://github.com/milvus-io/milvus-sdk-cpp/issues/246
milvus::PartitionsInfo partitionsInfo{};
status = client_->ShowPartitions("Foo", std::vector<std::string>{}, partitionsInfo);
EXPECT_TRUE(status.IsOk());

names.emplace_back("Foo");
collection_infos.clear();
status = client_->LoadCollection("Foo");
Expand Down

0 comments on commit daf51a9

Please sign in to comment.