milvus
milvus copied to clipboard
[Bug]: Range search with invalid parameters does not report error when searching the empty collection
Is there an existing issue for this?
- [X] I have searched the existing issues
Environment
- Milvus version: master-20240129-74cfba02
- Deployment mode(standalone or cluster): both
- MQ type(rocksmq, pulsar or kafka): all
- SDK version(e.g. pymilvus v2.0.0rc2): 2.4.0rc26
- OS(Ubuntu or CentOS):
- CPU/Memory:
- GPU:
- Others:
Current Behavior
Range search with invalid parameters does not report error:
-
for IP metric type: if range_filter < radius, it should report error: range_filter must more than radius when IP
-
for non-IP metric type( for example, L2), if range_filter > radius, it should report error: range_filter must less than radius except IP
but now all these scenarios does report error, and return empty
[2024-01-30 14:36:15 - DEBUG - ci_test]: (api_response) : None (api_request.py:37)
[2024-01-30 14:36:15 - INFO - ci_test]: test_range_search_invalid_radius_range_filter_IP: Range searching collection search_collection_Eq8BILvK (test_search.py:1192)
[2024-01-30 14:36:15 - DEBUG - ci_test]: (api_request) : [Collection.search] args: [[[0.6977766088552649, 0.17404960809797387, 0.5248190772854204, 0.6504801986921493, 0.035124070966529364, 0.5747853028738286, 0.19016897169166258, 0.3704721429544069, 0.40834544889559976, 0.2954712447091564, 0.4026324785087212, 0.24069691601934984, 0.4760760329808238, 0.5381268534761863, 0.175327182......, kwargs: {} (api_request.py:62)
[2024-01-30 14:36:15 - DEBUG - ci_test]: (api_response) : ['[]', '[]'] (api_request.py:37)
Expected Behavior
-
for IP metric type: if range_filter < radius, it should report error: range_filter must more than radius when IP
-
for non-IP metric type( for example, L2), if range_filter > radius, it should report error: range_filter must less than radius except IP
Steps To Reproduce
@pytest.mark.tags(CaseLabel.L1)
def test_range_search_invalid_radius_range_filter_L2(self):
"""
target: test range search with invalid radius and range_filter for L2
method: range search with radius smaller than range_filter
expected: raise exception and report the error
"""
# 1. initialize with data
collection_w = self.init_collection_general(prefix, is_index=False)[0]
# 2. create index
flat_index = {"index_type": "FLAT", "params": {}, "metric_type": "L2"}
collection_w.create_index(ct.default_float_vec_field_name, flat_index)
# 3. load
collection_w.load()
# 4. range search
log.info("test_range_search_invalid_radius_range_filter_L2: Range searching collection %s" %
collection_w.name)
range_search_params = {"metric_type": "L2", "params": {"nprobe": 10, "radius": 1, "range_filter": 10}}
collection_w.search(vectors[:default_nq], default_search_field,
range_search_params, default_limit,
default_search_exp,
check_task=CheckTasks.err_res,
check_items={"err_code": 65535,
"err_msg": "range_filter must less than radius except IP"})
@pytest.mark.tags(CaseLabel.L1)
def test_range_search_invalid_radius_range_filter_IP(self):
"""
target: test range search with invalid radius and range_filter for IP
method: range search with radius larger than range_filter
expected: raise exception and report the error
"""
# 1. initialize with data
collection_w = self.init_collection_general(prefix, is_index=False)[0]
# 2. create index
flat_index = {"index_type": "FLAT", "params": {}, "metric_type": "IP"}
collection_w.create_index(ct.default_float_vec_field_name, flat_index)
# 3. load
collection_w.load()
# 4. range search
log.info("test_range_search_invalid_radius_range_filter_IP: Range searching collection %s" %
collection_w.name)
range_search_params = {"metric_type": "IP",
"params": {"nprobe": 10, "radius": 10, "range_filter": 1}}
collection_w.search(vectors[:default_nq], default_search_field,
range_search_params, default_limit,
default_search_exp,
check_task=CheckTasks.err_res,
check_items={"err_code": 65535,
"err_msg": "range_filter must more than radius when IP"})
Milvus Log
No response
Anything else?
No response
it exists both in master and 2.3 branch.
And same issue when input invalid type data to "radius" or "range_filter", it does not report error and return empty result now:
[2024-01-30 14:49:51 - INFO - ci_test]: test_range_search_invalid_radius: Range searching collection search_collection_U9cmRZYb (test_search.py:1118)
[2024-01-30 14:49:51 - DEBUG - ci_test]: (api_request) : [Collection.search] args: [[[0.680752458401664, 0.7659377016866495, 0.45954331139715576, 0.6814144845893145, 0.6986881765807924, 0.09234792093879418, 0.11874577707660816, 0.5145528781293267, 0.647720313148759, 0.6214872787578342, 0.8259285448962721, 0.28803375542613174, 0.05543219161344559, 0.7049144088943937, 0.427156219822......, kwargs: {} (api_request.py:62)
[2024-01-30 14:49:51 - DEBUG - ci_test]: (api_response) : ['[]', '[]'] (api_request.py:37)
@pytest.mark.tags(CaseLabel.L2)
def test_range_search_invalid_radius(self, get_invalid_range_search_paras):
"""
target: test range search with invalid radius
method: range search with invalid radius
expected: raise exception and report the error
"""
# 1. initialize with data
collection_w = self.init_collection_general(prefix)[0]
# 2. range search
log.info("test_range_search_invalid_radius: Range searching collection %s" %
collection_w.name)
radius = get_invalid_range_search_paras
range_search_params = {"metric_type": "L2",
"params": {"nprobe": 10, "radius": radius, "range_filter": 0}}
collection_w.search(vectors[:default_nq], default_search_field,
range_search_params, default_limit,
default_search_exp,
check_task=CheckTasks.err_res,
check_items={"err_code": 1,
"err_msg": "type must be number"})
@pytest.mark.tags(CaseLabel.L2)
def test_range_search_invalid_range_filter(self, get_invalid_range_search_paras):
"""
target: test range search with invalid range_filter
method: range search with invalid range_filter
expected: raise exception and report the error
"""
# 1. initialize with data
collection_w = self.init_collection_general(prefix, is_index=False)[0]
# 2. create index
flat_index = {"index_type": "FLAT", "params": {}, "metric_type": "L2"}
collection_w.create_index(ct.default_float_vec_field_name, flat_index)
# 3. load
collection_w.load()
# 2. range search
log.info("test_range_search_invalid_range_filter: Range searching collection %s" %
collection_w.name)
range_filter = get_invalid_range_search_paras
range_search_params = {"metric_type": "L2",
"params": {"nprobe": 10, "radius": 1, "range_filter": range_filter}}
collection_w.search(vectors[:default_nq], default_search_field,
range_search_params, default_limit,
default_search_exp,
check_task=CheckTasks.err_res,
check_items={"err_code": 1,
"err_msg": "type must be number"})
/assign @czs007 /unassign
@smellthemoon please help analyze this
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen
.
@smellthemoon was this fixed
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen
.
keep it
@smellthemoon please share some info about the fix ideas of status
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen
.