Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/crud' into crud
Browse files Browse the repository at this point in the history
  • Loading branch information
youny626 committed Feb 25, 2020
2 parents 95b7f9f + 34507e8 commit 62f9d3e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 174 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Please mark all change in change log and use the issue from GitHub
- \#1029 - check if table exists when try to delete partition
- \#1066 - optimize http insert and search speed
- \#1067 - Add binary vectors support in http server
- \#1152 - Error log output continuously after server start
- \#1075 - improve error message when page size or offset is illegal
- \#1082 - check page_size or offset value to avoid float
- \#1115 - http server support load table into memory
- \#1152 - Error log output continuously after server start
- \#1211 - Server down caused by searching with index_type: HNSW
- \#1240 - Update license declaration
- \#1298 - Unittest failed when on CPU2GPU case
Expand Down Expand Up @@ -54,12 +54,14 @@ Please mark all change in change log and use the issue from GitHub
- \#966 - Update NOTICE.md
- \#1002 - Rename minio to s3 in Storage Config section
- \#1078 - Move 'insert_buffer_size' to Cache Config section
- \#1105 - Error message is not clear when creating IVFSQ8H index without gpu resources
- \#1297 - Hide partition_name parameter, avid user directly access partition table
- \#1310 - Add default partition tag for a table
- \#1105 - Error message is not clear when creating IVFSQ8H index without gpu resources
- \#740, #849, #878, #972, #1033, #1161, #1173, #1199, #1190, #1223, #1222, #1257, #1264, #1269, #1164, #1304, #1324 - Various fixes and improvements for Milvus documentation.
- \#1320 - Remove debug logging from faiss


## Task

# Milvus 0.6.0 (2019-12-07)
Expand Down
2 changes: 1 addition & 1 deletion tests/milvus_python_test/test_get_vector_by_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def get_simple_index_params(self, request, connect):
def get_id(self, request):
yield request.param

def _test_get_vectors_after_index_created(self, connect, table, get_simple_index_params, get_id):
def test_get_vectors_after_index_created(self, connect, table, get_simple_index_params, get_id):
'''
target: test get vector after index created
method: add vector, create index and get vector
Expand Down
23 changes: 18 additions & 5 deletions tests/milvus_python_test/test_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ def test_create_different_partition_tags(self, connect, table):
assert status.OK()
status, res = connect.show_partitions(table)
assert status.OK()
assert tag in res
assert tag_name in res
tag_list = []
for item in res:
tag_list.append(item.tag)
assert tag in tag_list
assert tag_name in tag_list
assert "_default" in tag_list

def test_create_partition_add_vectors_default(self, connect, table):
'''
Expand Down Expand Up @@ -232,7 +236,10 @@ def test_drop_partition(self, connect, table):
status = connect.drop_partition(table, tag)
assert status.OK()
status, res = connect.show_partitions(table)
assert tag not in res
tag_list = []
for item in res:
tag_list.append(item.tag)
assert tag not in tag_list

def test_drop_partition_tag_not_existed(self, connect, table):
'''
Expand Down Expand Up @@ -268,7 +275,10 @@ def test_drop_partition_repeatedly(self, connect, table):
time.sleep(2)
assert not status.OK()
status, res = connect.show_partitions(table)
assert tag not in res
tag_list = []
for item in res:
tag_list.append(item.tag)
assert tag not in tag_list

def test_drop_partition_create(self, connect, table):
'''
Expand All @@ -282,7 +292,10 @@ def test_drop_partition_create(self, connect, table):
status = connect.create_partition(table, tag)
assert status.OK()
status, res = connect.show_partitions(table)
assert tag in res
tag_list = []
for item in res:
tag_list.append(item.tag)
assert tag in tag_list


class TestNameInvalid(object):
Expand Down
131 changes: 0 additions & 131 deletions tests/milvus_python_test/test_search_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,95 +463,6 @@ def test_search_top_k_query_records(self, connect, table):
assert len(result[i]) == top_k
assert result[i][0].distance <= epsilon

"""
generate invalid query range params
"""
@pytest.fixture(
scope="function",
params=[
(get_current_day(), get_current_day()),
(get_last_day(1), get_last_day(1)),
(get_next_day(1), get_next_day(1))
]
)
def get_invalid_range(self, request):
yield request.param

# disable
def _test_search_invalid_query_ranges(self, connect, table, get_invalid_range):
'''
target: search table with query ranges
method: search with the same query ranges
expected: status not ok
'''
top_k = 2
nprobe = 1
vectors, ids = self.init_data(connect, table)
query_vecs = [vectors[0]]
query_ranges = [get_invalid_range]
status, result = connect.search_vectors(table, top_k, nprobe, query_vecs, query_ranges=query_ranges)
assert not status.OK()
assert len(result) == 0

"""
generate valid query range params, no search result
"""
@pytest.fixture(
scope="function",
params=[
(get_last_day(2), get_last_day(1)),
(get_next_day(1), get_next_day(2))
]
)
def get_valid_range_no_result(self, request):
yield request.param

# disable
def _test_search_valid_query_ranges_no_result(self, connect, table, get_valid_range_no_result):
'''
target: search table with normal query ranges, but no data in db
method: search with query ranges (low, low)
expected: length of result is 0
'''
top_k = 2
nprobe = 1
vectors, ids = self.init_data(connect, table)
query_vecs = [vectors[0]]
query_ranges = [get_valid_range_no_result]
status, result = connect.search_vectors(table, top_k, nprobe, query_vecs, query_ranges=query_ranges)
assert status.OK()
assert len(result) == 0

"""
generate valid query range params, no search result
"""
@pytest.fixture(
scope="function",
params=[
(get_last_day(2), get_next_day(2)),
(get_current_day(), get_next_day(2)),
]
)
def get_valid_range(self, request):
yield request.param

# disable
def _test_search_valid_query_ranges(self, connect, table, get_valid_range):
'''
target: search table with normal query ranges, but no data in db
method: search with query ranges (low, normal)
expected: length of result is 0
'''
top_k = 2
nprobe = 1
vectors, ids = self.init_data(connect, table)
query_vecs = [vectors[0]]
query_ranges = [get_valid_range]
status, result = connect.search_vectors(table, top_k, nprobe, query_vecs, query_ranges=query_ranges)
assert status.OK()
assert len(result) == 1
assert result[0][0].distance <= epsilon

def test_search_distance_l2_flat_index(self, connect, table):
'''
target: search table, and check the result: distance
Expand Down Expand Up @@ -976,48 +887,6 @@ def test_search_with_invalid_nprobe_ip(self, connect, ip_table, get_nprobes):
with pytest.raises(Exception) as e:
status, result = connect.search_vectors(ip_table, top_k, nprobe, query_vecs)

"""
Test search table with invalid query ranges
"""
@pytest.fixture(
scope="function",
params=gen_invalid_query_ranges()
)
def get_query_ranges(self, request):
yield request.param

# disable
@pytest.mark.level(1)
def _test_search_flat_with_invalid_query_range(self, connect, table, get_query_ranges):
'''
target: test search fuction, with the wrong query_range
method: search with query_range
expected: raise an error, and the connection is normal
'''
top_k = 1
nprobe = 1
query_vecs = [vectors[0]]
query_ranges = get_query_ranges
logging.getLogger().info(query_ranges)
with pytest.raises(Exception) as e:
status, result = connect.search_vectors(table, 1, nprobe, query_vecs, query_ranges=query_ranges)

# disable
@pytest.mark.level(2)
def _test_search_flat_with_invalid_query_range_ip(self, connect, ip_table, get_query_ranges):
'''
target: test search fuction, with the wrong query_range
method: search with query_range
expected: raise an error, and the connection is normal
'''
top_k = 1
nprobe = 1
query_vecs = [vectors[0]]
query_ranges = get_query_ranges
logging.getLogger().info(query_ranges)
with pytest.raises(Exception) as e:
status, result = connect.search_vectors(ip_table, 1, nprobe, query_vecs, query_ranges=query_ranges)


def check_result(result, id):
if len(result) >= 5:
Expand Down
36 changes: 0 additions & 36 deletions tests/milvus_python_test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,42 +422,6 @@ def gen_invalid_vector_ids():
return invalid_vector_ids



def gen_invalid_query_ranges():
query_ranges = [
[(get_last_day(1), "")],
[(get_current_day(), "")],
[(get_next_day(1), "")],
[(get_current_day(), get_last_day(1))],
[(get_next_day(1), get_last_day(1))],
[(get_next_day(1), get_current_day())],
[(0, get_next_day(1))],
[(-1, get_next_day(1))],
[(1, get_next_day(1))],
[(100001, get_next_day(1))],
[(1000000000000001, get_next_day(1))],
[(None, get_next_day(1))],
[([1,2,3], get_next_day(1))],
[((1,2), get_next_day(1))],
[({"a": 1}, get_next_day(1))],
[(" ", get_next_day(1))],
[("", get_next_day(1))],
[("String", get_next_day(1))],
[("12-s", get_next_day(1))],
[("BB。A", get_next_day(1))],
[(" siede ", get_next_day(1))],
[("(mn)", get_next_day(1))],
[("#12s", get_next_day(1))],
[("pip+", get_next_day(1))],
[("=c", get_next_day(1))],
[("\n", get_next_day(1))],
[("\t", get_next_day(1))],
[("中文", get_next_day(1))],
[("a".join("a" for i in range(256)), get_next_day(1))]
]
return query_ranges


def gen_invalid_index_params():
index_params = []
for index_type in gen_invalid_index_types():
Expand Down

0 comments on commit 62f9d3e

Please sign in to comment.