* fix

Signed-off-by: Nicky <nicky.xj.lin@gmail.com>

* update.

Signed-off-by: Nicky <nicky.xj.lin@gmail.com>

* lint pass

Signed-off-by: xiaojun.lin <xiaojun.lin@zilliz.com>

* UPDATE CASE: search with tag not exist

Signed-off-by: zw <zw@zilliz.com>

Co-authored-by: zw <zw@zilliz.com>
pull/1769/head
Tinkerrr 2020-03-26 18:28:24 +08:00 committed by GitHub
parent e9f7422bc5
commit 243e843aac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

View File

@ -19,6 +19,7 @@ Please mark all change in change log and use the issue from GitHub
- \#1728 Optimize request handler to combine similar query - \#1728 Optimize request handler to combine similar query
- \#1734 Opentracing for combined search request - \#1734 Opentracing for combined search request
- \#1735 Fix search out of memory with ivf_flat - \#1735 Fix search out of memory with ivf_flat
- \#1747 Expected error status if search with partition_tag not existed
- \#1756 Fix memory exhausted during searching - \#1756 Fix memory exhausted during searching
## Feature ## Feature

View File

@ -1130,7 +1130,10 @@ DBImpl::Query(const std::shared_ptr<server::Context>& context, const std::string
} else { } else {
// get files from specified partitions // get files from specified partitions
std::set<std::string> partition_name_array; std::set<std::string> partition_name_array;
GetPartitionsByTags(table_id, partition_tags, partition_name_array); status = GetPartitionsByTags(table_id, partition_tags, partition_name_array);
if (!status.ok()) {
return status; // didn't match any partition.
}
for (auto& partition_name : partition_name_array) { for (auto& partition_name : partition_name_array) {
status = GetFilesToSearch(partition_name, files_array); status = GetFilesToSearch(partition_name, files_array);
@ -1665,6 +1668,10 @@ DBImpl::GetPartitionsByTags(const std::string& table_id, const std::vector<std::
} }
} }
if (partition_name_array.empty()) {
return Status(PARTITION_NOT_FOUND, "Cannot find the specified partitions");
}
return Status::OK(); return Status::OK();
} }

View File

@ -93,6 +93,7 @@ constexpr ErrorCode DB_INCOMPATIB_META = ToDbErrorCode(6);
constexpr ErrorCode DB_INVALID_META_URI = ToDbErrorCode(7); constexpr ErrorCode DB_INVALID_META_URI = ToDbErrorCode(7);
constexpr ErrorCode DB_EMPTY_TABLE = ToDbErrorCode(8); constexpr ErrorCode DB_EMPTY_TABLE = ToDbErrorCode(8);
constexpr ErrorCode DB_BLOOM_FILTER_ERROR = ToDbErrorCode(9); constexpr ErrorCode DB_BLOOM_FILTER_ERROR = ToDbErrorCode(9);
constexpr ErrorCode PARTITION_NOT_FOUND = ToDbErrorCode(10);
// knowhere error code // knowhere error code
constexpr ErrorCode KNOWHERE_ERROR = ToKnowhereErrorCode(1); constexpr ErrorCode KNOWHERE_ERROR = ToKnowhereErrorCode(1);

View File

@ -327,8 +327,7 @@ class TestSearchBase:
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, result = connect.search_vectors(collection, top_k, query_vec, partition_tags=["new_tag"], params=search_param) status, result = connect.search_vectors(collection, top_k, query_vec, partition_tags=["new_tag"], params=search_param)
logging.getLogger().info(result) logging.getLogger().info(result)
assert status.OK() assert not status.OK()
assert len(result) == 0
def test_search_l2_index_params_partition_E(self, connect, collection, get_simple_index): def test_search_l2_index_params_partition_E(self, connect, collection, get_simple_index):
''' '''