Signed-off-by: Zhiru Zhu <zzhu@fandm.edu>
This commit is contained in:
Zhiru Zhu 2020-03-09 11:44:28 +08:00
parent b3bba221d0
commit 7f3abf1c64
No known key found for this signature in database
GPG Key ID: AB8AD6F124821076
2 changed files with 32 additions and 24 deletions

View File

@ -124,7 +124,8 @@ TEST_F(DeleteTest, delete_in_mem) {
std::vector<std::string> tags; std::vector<std::string> tags;
milvus::engine::ResultIds result_ids; milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances; milvus::engine::ResultDistances result_distances;
stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids, result_distances); stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids,
result_distances);
ASSERT_NE(result_ids[0], pair.first); ASSERT_NE(result_ids[0], pair.first);
// ASSERT_LT(result_distances[0], 1e-4); // ASSERT_LT(result_distances[0], 1e-4);
ASSERT_GT(result_distances[0], 1); ASSERT_GT(result_distances[0], 1);
@ -192,7 +193,8 @@ TEST_F(DeleteTest, delete_on_disk) {
std::vector<std::string> tags; std::vector<std::string> tags;
milvus::engine::ResultIds result_ids; milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances; milvus::engine::ResultDistances result_distances;
stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids, result_distances); stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids,
result_distances);
ASSERT_NE(result_ids[0], pair.first); ASSERT_NE(result_ids[0], pair.first);
// ASSERT_LT(result_distances[0], 1e-4); // ASSERT_LT(result_distances[0], 1e-4);
ASSERT_GT(result_distances[0], 1); ASSERT_GT(result_distances[0], 1);
@ -254,7 +256,8 @@ TEST_F(DeleteTest, delete_multiple_times) {
std::vector<std::string> tags; std::vector<std::string> tags;
milvus::engine::ResultIds result_ids; milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances; milvus::engine::ResultDistances result_distances;
stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids, result_distances); stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids,
result_distances);
ASSERT_NE(result_ids[0], pair.first); ASSERT_NE(result_ids[0], pair.first);
// ASSERT_LT(result_distances[0], 1e-4); // ASSERT_LT(result_distances[0], 1e-4);
ASSERT_GT(result_distances[0], 1); ASSERT_GT(result_distances[0], 1);
@ -330,7 +333,8 @@ TEST_F(DeleteTest, delete_with_index) {
std::vector<std::string> tags; std::vector<std::string> tags;
milvus::engine::ResultIds result_ids; milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances; milvus::engine::ResultDistances result_distances;
stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids, result_distances); stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids,
result_distances);
ASSERT_NE(result_ids[0], pair.first); ASSERT_NE(result_ids[0], pair.first);
// ASSERT_LT(result_distances[0], 1e-4); // ASSERT_LT(result_distances[0], 1e-4);
ASSERT_GT(result_distances[0], 1); ASSERT_GT(result_distances[0], 1);
@ -406,7 +410,8 @@ TEST_F(DeleteTest, delete_multiple_times_with_index) {
std::vector<std::string> tags; std::vector<std::string> tags;
milvus::engine::ResultIds result_ids; milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances; milvus::engine::ResultDistances result_distances;
stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids, result_distances); stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, search, result_ids,
result_distances);
ASSERT_TRUE(stat.ok()); ASSERT_TRUE(stat.ok());
ASSERT_NE(result_ids[0], pair.first); ASSERT_NE(result_ids[0], pair.first);
// ASSERT_LT(result_distances[0], 1e-4); // ASSERT_LT(result_distances[0], 1e-4);
@ -523,8 +528,8 @@ TEST_F(DeleteTest, delete_add_create_index) {
result_ids.clear(); result_ids.clear();
result_distances.clear(); result_distances.clear();
stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, ids_to_delete.front(), result_ids, stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, ids_to_delete.front(),
result_distances); result_ids, result_distances);
ASSERT_EQ(result_ids[0], -1); ASSERT_EQ(result_ids[0], -1);
ASSERT_EQ(result_distances[0], std::numeric_limits<float>::max()); ASSERT_EQ(result_distances[0], std::numeric_limits<float>::max());
} }
@ -594,8 +599,8 @@ TEST_F(DeleteTest, delete_add_auto_flush) {
result_ids.clear(); result_ids.clear();
result_distances.clear(); result_distances.clear();
stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, ids_to_delete.front(), result_ids, stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, {{"nprobe", nprobe}}, ids_to_delete.front(),
result_distances); result_ids, result_distances);
ASSERT_EQ(result_ids[0], -1); ASSERT_EQ(result_ids[0], -1);
ASSERT_EQ(result_distances[0], std::numeric_limits<float>::max()); ASSERT_EQ(result_distances[0], std::numeric_limits<float>::max());
} }
@ -646,8 +651,8 @@ TEST_F(CompactTest, compact_basic) {
milvus::engine::VectorsData qb = xb; milvus::engine::VectorsData qb = xb;
for (auto& id : ids_to_delete) { for (auto& id : ids_to_delete) {
stat = stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, id, result_ids,
db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, id, result_ids, result_distances); result_distances);
ASSERT_EQ(result_ids[0], -1); ASSERT_EQ(result_ids[0], -1);
ASSERT_EQ(result_distances[0], std::numeric_limits<float>::max()); ASSERT_EQ(result_distances[0], std::numeric_limits<float>::max());
} }
@ -736,8 +741,8 @@ TEST_F(CompactTest, compact_with_index) {
std::vector<std::string> tags; std::vector<std::string> tags;
milvus::engine::ResultIds result_ids; milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances; milvus::engine::ResultDistances result_distances;
stat = stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, json_params, search, result_ids,
db_->Query(dummy_context_, table_info.table_id_, tags, topk, json_params, search, result_ids, result_distances); result_distances);
ASSERT_NE(result_ids[0], pair.first); ASSERT_NE(result_ids[0], pair.first);
// ASSERT_LT(result_distances[0], 1e-4); // ASSERT_LT(result_distances[0], 1e-4);
ASSERT_GT(result_distances[0], 1); ASSERT_GT(result_distances[0], 1);

View File

@ -108,7 +108,8 @@ TEST_F(SearchByIdTest, basic) {
milvus::engine::ResultIds result_ids; milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances; milvus::engine::ResultDistances result_distances;
stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, i, result_ids, result_distances); stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, i, result_ids,
result_distances);
ASSERT_EQ(result_ids[0], i); ASSERT_EQ(result_ids[0], i);
ASSERT_LT(result_distances[0], 1e-4); ASSERT_LT(result_distances[0], 1e-4);
} }
@ -165,7 +166,8 @@ TEST_F(SearchByIdTest, with_index) {
milvus::engine::ResultIds result_ids; milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances; milvus::engine::ResultDistances result_distances;
stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, i, result_ids, result_distances); stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, i, result_ids,
result_distances);
ASSERT_EQ(result_ids[0], i); ASSERT_EQ(result_ids[0], i);
ASSERT_LT(result_distances[0], 1e-3); ASSERT_LT(result_distances[0], 1e-3);
} }
@ -225,7 +227,8 @@ TEST_F(SearchByIdTest, with_delete) {
milvus::engine::ResultIds result_ids; milvus::engine::ResultIds result_ids;
milvus::engine::ResultDistances result_distances; milvus::engine::ResultDistances result_distances;
stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, i, result_ids, result_distances); stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, i, result_ids,
result_distances);
ASSERT_EQ(result_ids[0], -1); ASSERT_EQ(result_ids[0], -1);
ASSERT_EQ(result_distances[0], std::numeric_limits<float>::max()); ASSERT_EQ(result_distances[0], std::numeric_limits<float>::max());
} }
@ -280,8 +283,8 @@ TEST_F(GetVectorByIdTest, basic) {
stat = db_->GetVectorByID(table_info.table_id_, id, vector); stat = db_->GetVectorByID(table_info.table_id_, id, vector);
ASSERT_TRUE(stat.ok()); ASSERT_TRUE(stat.ok());
stat = stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, json_params, vector, result_ids,
db_->Query(dummy_context_, table_info.table_id_, tags, topk, json_params, vector, result_ids, result_distances); result_distances);
ASSERT_TRUE(stat.ok()); ASSERT_TRUE(stat.ok());
ASSERT_EQ(result_ids[0], id); ASSERT_EQ(result_ids[0], id);
ASSERT_LT(result_distances[0], 1e-4); ASSERT_LT(result_distances[0], 1e-4);
@ -343,8 +346,8 @@ TEST_F(GetVectorByIdTest, with_index) {
stat = db_->GetVectorByID(table_info.table_id_, id, vector); stat = db_->GetVectorByID(table_info.table_id_, id, vector);
ASSERT_TRUE(stat.ok()); ASSERT_TRUE(stat.ok());
stat = stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, json_params, vector, result_ids,
db_->Query(dummy_context_, table_info.table_id_, tags, topk, json_params, vector, result_ids, result_distances); result_distances);
ASSERT_EQ(result_ids[0], id); ASSERT_EQ(result_ids[0], id);
ASSERT_LT(result_distances[0], 1e-3); ASSERT_LT(result_distances[0], 1e-3);
} }
@ -483,8 +486,8 @@ TEST_F(SearchByIdTest, BINARY) {
ASSERT_TRUE(stat.ok()); ASSERT_TRUE(stat.ok());
ASSERT_EQ(vector.vector_count_, 1); ASSERT_EQ(vector.vector_count_, 1);
stat = stat = db_->Query(dummy_context_, table_info.table_id_, tags, topk, json_params, vector, result_ids,
db_->Query(dummy_context_, table_info.table_id_, tags, topk, json_params, vector, result_ids, result_distances); result_distances);
ASSERT_TRUE(stat.ok()); ASSERT_TRUE(stat.ok());
ASSERT_EQ(result_ids[0], id); ASSERT_EQ(result_ids[0], id);
ASSERT_LT(result_distances[0], 1e-4); ASSERT_LT(result_distances[0], 1e-4);
@ -493,8 +496,8 @@ TEST_F(SearchByIdTest, BINARY) {
result_ids.clear(); result_ids.clear();
result_distances.clear(); result_distances.clear();
stat = stat = db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, id, result_ids,
db_->QueryByID(dummy_context_, table_info.table_id_, tags, topk, json_params, id, result_ids, result_distances); result_distances);
ASSERT_TRUE(stat.ok()); ASSERT_TRUE(stat.ok());
ASSERT_EQ(result_ids[0], id); ASSERT_EQ(result_ids[0], id);
ASSERT_LT(result_distances[0], 1e-4); ASSERT_LT(result_distances[0], 1e-4);