mirror of https://github.com/milvus-io/milvus.git
Modify test cases for covering travel timestamp (#10323)
Signed-off-by: Binbin Lv <binbin.lv@zilliz.com>pull/10329/head
parent
de43c1a2ed
commit
fc2839f254
|
@ -150,6 +150,7 @@ class TestcaseBase(Base):
|
||||||
vectors = []
|
vectors = []
|
||||||
binary_raw_vectors = []
|
binary_raw_vectors = []
|
||||||
insert_ids = []
|
insert_ids = []
|
||||||
|
time_stamp = 0
|
||||||
# 1 create collection
|
# 1 create collection
|
||||||
default_schema = cf.gen_default_collection_schema(auto_id=auto_id, dim=dim)
|
default_schema = cf.gen_default_collection_schema(auto_id=auto_id, dim=dim)
|
||||||
if is_binary:
|
if is_binary:
|
||||||
|
@ -164,16 +165,15 @@ class TestcaseBase(Base):
|
||||||
cf.gen_partitions(collection_w, partition_num)
|
cf.gen_partitions(collection_w, partition_num)
|
||||||
# 3 insert data if specified
|
# 3 insert data if specified
|
||||||
if insert_data:
|
if insert_data:
|
||||||
collection_w, vectors, binary_raw_vectors, insert_ids = \
|
collection_w, vectors, binary_raw_vectors, insert_ids, time_stamp = \
|
||||||
cf.insert_data(collection_w, nb, is_binary, is_all_data_type,
|
cf.insert_data(collection_w, nb, is_binary, is_all_data_type, auto_id=auto_id, dim=dim)
|
||||||
auto_id=auto_id, dim=dim)
|
|
||||||
assert collection_w.is_empty is False
|
assert collection_w.is_empty is False
|
||||||
assert collection_w.num_entities == nb
|
assert collection_w.num_entities == nb
|
||||||
# This condition will be removed after auto index feature
|
# This condition will be removed after auto index feature
|
||||||
if not is_index:
|
if not is_index:
|
||||||
collection_w.load()
|
collection_w.load()
|
||||||
|
|
||||||
return collection_w, vectors, binary_raw_vectors, insert_ids
|
return collection_w, vectors, binary_raw_vectors, insert_ids, time_stamp
|
||||||
|
|
||||||
def insert_entities_into_two_partitions_in_half(self, half, prefix='query'):
|
def insert_entities_into_two_partitions_in_half(self, half, prefix='query'):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -509,12 +509,13 @@ def insert_data(collection_w, nb=3000, is_binary=False, is_all_data_type=False,
|
||||||
if auto_id:
|
if auto_id:
|
||||||
default_data.drop(ct.default_int64_field_name, axis=1, inplace=True)
|
default_data.drop(ct.default_int64_field_name, axis=1, inplace=True)
|
||||||
insert_res = collection_w.insert(default_data, par[i].name)[0]
|
insert_res = collection_w.insert(default_data, par[i].name)[0]
|
||||||
|
time_stamp = insert_res.timestamp
|
||||||
insert_ids.extend(insert_res.primary_keys)
|
insert_ids.extend(insert_res.primary_keys)
|
||||||
vectors.append(default_data)
|
vectors.append(default_data)
|
||||||
start = start + nb // num
|
start = start + nb // num
|
||||||
log.info("insert_data: inserted data into collection %s (num_entities: %s)"
|
log.info("insert_data: inserted data into collection %s (num_entities: %s)"
|
||||||
% (collection_w.name, nb))
|
% (collection_w.name, nb))
|
||||||
return collection_w, vectors, binary_raw_vectors, insert_ids
|
return collection_w, vectors, binary_raw_vectors, insert_ids, time_stamp
|
||||||
|
|
||||||
|
|
||||||
def _check_primary_keys(primary_keys, nb):
|
def _check_primary_keys(primary_keys, nb):
|
||||||
|
|
|
@ -13,7 +13,7 @@ pytest-print==0.2.1
|
||||||
pytest-level==0.1.1
|
pytest-level==0.1.1
|
||||||
pytest-xdist==2.2.1
|
pytest-xdist==2.2.1
|
||||||
# pytest-parallel
|
# pytest-parallel
|
||||||
pymilvus==2.0.0rc8.dev9
|
pymilvus==2.0.0rc8.dev12
|
||||||
pytest-rerunfailures==9.1.1
|
pytest-rerunfailures==9.1.1
|
||||||
git+https://github.com/Projectplace/pytest-tags
|
git+https://github.com/Projectplace/pytest-tags
|
||||||
ndg-httpsclient
|
ndg-httpsclient
|
||||||
|
|
|
@ -32,7 +32,7 @@ class TestDeleteParams(TestcaseBase):
|
||||||
expected: assert num entities
|
expected: assert num entities
|
||||||
"""
|
"""
|
||||||
# init collection with default_nb default data
|
# init collection with default_nb default data
|
||||||
collection_w, _, _, ids = self.init_collection_general(prefix, insert_data=True, is_binary=is_binary)
|
collection_w, _, _, ids = self.init_collection_general(prefix, insert_data=True, is_binary=is_binary)[0:4]
|
||||||
expr = f'{ct.default_int64_field_name} in {ids[:half_nb]}'
|
expr = f'{ct.default_int64_field_name} in {ids[:half_nb]}'
|
||||||
|
|
||||||
# delete half of data
|
# delete half of data
|
||||||
|
@ -123,10 +123,11 @@ class TestDeleteParams(TestcaseBase):
|
||||||
expected: num entities becomes zero
|
expected: num entities becomes zero
|
||||||
"""
|
"""
|
||||||
# init collection with default_nb default data
|
# init collection with default_nb default data
|
||||||
collection_w, _, _, ids = self.init_collection_general(prefix, insert_data=True)
|
collection_w, _, _, ids = self.init_collection_general(prefix, insert_data=True)[0:4]
|
||||||
expr = f'{ct.default_int64_field_name} in {ids}'
|
expr = f'{ct.default_int64_field_name} in {ids}'
|
||||||
del_res, _ = collection_w.delete(expr)
|
del_res, _ = collection_w.delete(expr)
|
||||||
assert del_res.delete_count == ct.default_nb
|
assert del_res.delete_count == ct.default_nb
|
||||||
|
|
||||||
assert collection_w.num_entities == 0
|
assert collection_w.num_entities == 0
|
||||||
assert collection_w.is_empty
|
assert collection_w.is_empty
|
||||||
|
|
||||||
|
|
|
@ -932,7 +932,7 @@ class TestQueryOperation(TestcaseBase):
|
||||||
limit = 1000
|
limit = 1000
|
||||||
nb_old = 500
|
nb_old = 500
|
||||||
collection_w, vectors, binary_raw_vectors, insert_ids = \
|
collection_w, vectors, binary_raw_vectors, insert_ids = \
|
||||||
self.init_collection_general(prefix, True, nb_old)
|
self.init_collection_general(prefix, True, nb_old)[0:4]
|
||||||
|
|
||||||
# 2. search for original data after load
|
# 2. search for original data after load
|
||||||
vectors_s = [[random.random() for _ in range(ct.default_dim)] for _ in range(ct.default_nq)]
|
vectors_s = [[random.random() for _ in range(ct.default_dim)] for _ in range(ct.default_nq)]
|
||||||
|
|
|
@ -281,7 +281,7 @@ class TestCollectionSearchInvalid(TestcaseBase):
|
||||||
if index == "FLAT":
|
if index == "FLAT":
|
||||||
pytest.skip("skip in FLAT index")
|
pytest.skip("skip in FLAT index")
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, 5000,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, 5000,
|
||||||
is_index=True)
|
is_index=True)
|
||||||
# 2. create index and load
|
# 2. create index and load
|
||||||
default_index = {"index_type": index, "params": params, "metric_type": "L2"}
|
default_index = {"index_type": index, "params": params, "metric_type": "L2"}
|
||||||
|
@ -552,7 +552,7 @@ class TestCollectionSearchInvalid(TestcaseBase):
|
||||||
expected: searched successfully
|
expected: searched successfully
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, 5000,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, 5000,
|
||||||
partition_num=1,
|
partition_num=1,
|
||||||
is_index=True)
|
is_index=True)
|
||||||
# 2. create different index
|
# 2. create different index
|
||||||
|
@ -641,7 +641,7 @@ class TestCollectionSearchInvalid(TestcaseBase):
|
||||||
expected: raise exception
|
expected: raise exception
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True)
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True)
|
||||||
# 2. search
|
# 2. search
|
||||||
log.info("test_search_with_output_fields_not_exist: Searching collection %s" % collection_w.name)
|
log.info("test_search_with_output_fields_not_exist: Searching collection %s" % collection_w.name)
|
||||||
collection_w.search(vectors[:default_nq], default_search_field,
|
collection_w.search(vectors[:default_nq], default_search_field,
|
||||||
|
@ -730,7 +730,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search successfully with limit(topK)
|
expected: search successfully with limit(topK)
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = \
|
collection_w, _, _, insert_ids, time_stamp = \
|
||||||
self.init_collection_general(prefix, True, auto_id=auto_id, dim=dim)
|
self.init_collection_general(prefix, True, auto_id=auto_id, dim=dim)
|
||||||
# 2. search
|
# 2. search
|
||||||
log.info("test_search_normal: searching collection %s" % collection_w.name)
|
log.info("test_search_normal: searching collection %s" % collection_w.name)
|
||||||
|
@ -738,6 +738,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:nq], default_search_field,
|
collection_w.search(vectors[:nq], default_search_field,
|
||||||
default_search_params, default_limit,
|
default_search_params, default_limit,
|
||||||
default_search_exp,
|
default_search_exp,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": nq,
|
check_items={"nq": nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -750,7 +751,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
method: create connections,collection insert and search vectors in collections
|
method: create connections,collection insert and search vectors in collections
|
||||||
expected: search successfully with limit(topK) and can be hit at top 1 (min distance is 0)
|
expected: search successfully with limit(topK) and can be hit at top 1 (min distance is 0)
|
||||||
"""
|
"""
|
||||||
collection_w, _vectors, _, insert_ids = \
|
collection_w, _vectors, _, insert_ids, _ = \
|
||||||
self.init_collection_general(prefix, True, auto_id=auto_id, dim=dim)
|
self.init_collection_general(prefix, True, auto_id=auto_id, dim=dim)
|
||||||
# get vectors that inserted into collection
|
# get vectors that inserted into collection
|
||||||
vectors = np.array(_vectors[0]).tolist()
|
vectors = np.array(_vectors[0]).tolist()
|
||||||
|
@ -796,7 +797,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search successfully with limit(topK)
|
expected: search successfully with limit(topK)
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = \
|
collection_w, _, _, insert_ids, _ = \
|
||||||
self.init_collection_general(prefix, True, auto_id=auto_id, dim=dim)
|
self.init_collection_general(prefix, True, auto_id=auto_id, dim=dim)
|
||||||
# 2. search
|
# 2. search
|
||||||
log.info("test_search_normal: searching collection %s" % collection_w.name)
|
log.info("test_search_normal: searching collection %s" % collection_w.name)
|
||||||
|
@ -804,6 +805,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:default_nq], default_search_field,
|
collection_w.search(vectors[:default_nq], default_search_field,
|
||||||
search_params, default_limit,
|
search_params, default_limit,
|
||||||
default_search_exp, _async=_async,
|
default_search_exp, _async=_async,
|
||||||
|
travel_timestamp=0,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": default_nq,
|
check_items={"nq": default_nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -823,7 +825,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
nb = 1000
|
nb = 1000
|
||||||
limit = 1000
|
limit = 1000
|
||||||
partition_num = 1
|
partition_num = 1
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
partition_num,
|
partition_num,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
|
@ -870,7 +872,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
nb = 1000
|
nb = 1000
|
||||||
limit = 1000
|
limit = 1000
|
||||||
partition_num = 1
|
partition_num = 1
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
partition_num,
|
partition_num,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
|
@ -916,7 +918,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
nb = 1000
|
nb = 1000
|
||||||
limit = 1000
|
limit = 1000
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
1, auto_id=auto_id,
|
1, auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
# 2. search all the partitions before partition deletion
|
# 2. search all the partitions before partition deletion
|
||||||
|
@ -957,7 +959,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search successfully
|
expected: search successfully
|
||||||
"""
|
"""
|
||||||
# 1. initialize without data
|
# 1. initialize without data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, time_stamp = self.init_collection_general(prefix, True, nb,
|
||||||
1, auto_id=auto_id,
|
1, auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
# 2. release collection
|
# 2. release collection
|
||||||
|
@ -971,6 +973,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
vectors = [[random.random() for _ in range(dim)] for _ in range(nq)]
|
vectors = [[random.random() for _ in range(dim)] for _ in range(nq)]
|
||||||
collection_w.search(vectors[:nq], default_search_field, default_search_params,
|
collection_w.search(vectors[:nq], default_search_field, default_search_params,
|
||||||
default_limit, default_search_exp, _async=_async,
|
default_limit, default_search_exp, _async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": nq,
|
check_items={"nq": nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -989,7 +992,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search successfully
|
expected: search successfully
|
||||||
"""
|
"""
|
||||||
# 1. initialize without data
|
# 1. initialize without data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, time_stamp = self.init_collection_general(prefix, True, nb,
|
||||||
1, auto_id=auto_id,
|
1, auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
# 2. release collection
|
# 2. release collection
|
||||||
|
@ -1005,6 +1008,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
vectors = [[random.random() for _ in range(dim)] for _ in range(nq)]
|
vectors = [[random.random() for _ in range(dim)] for _ in range(nq)]
|
||||||
collection_w.search(vectors[:nq], default_search_field, default_search_params,
|
collection_w.search(vectors[:nq], default_search_field, default_search_params,
|
||||||
limit, default_search_exp, _async=_async,
|
limit, default_search_exp, _async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": nq,
|
check_items={"nq": nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -1018,6 +1022,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:nq], default_search_field, default_search_params,
|
collection_w.search(vectors[:nq], default_search_field, default_search_params,
|
||||||
limit, default_search_exp,
|
limit, default_search_exp,
|
||||||
[par[1].name], _async=_async,
|
[par[1].name], _async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": nq,
|
check_items={"nq": nq,
|
||||||
"ids": insert_ids[par[0].num_entities:],
|
"ids": insert_ids[par[0].num_entities:],
|
||||||
|
@ -1065,7 +1070,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
limit = 1000
|
limit = 1000
|
||||||
nb_old = 500
|
nb_old = 500
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb_old,
|
collection_w, _, _, insert_ids, time_stamp = self.init_collection_general(prefix, True, nb_old,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
# 2. search for original data after load
|
# 2. search for original data after load
|
||||||
|
@ -1074,6 +1079,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:nq], default_search_field,
|
collection_w.search(vectors[:nq], default_search_field,
|
||||||
default_search_params, limit,
|
default_search_params, limit,
|
||||||
default_search_exp, _async=_async,
|
default_search_exp, _async=_async,
|
||||||
|
travel_timestamp=time_stamp+1,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": nq,
|
check_items={"nq": nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -1081,8 +1087,9 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
"_async": _async})
|
"_async": _async})
|
||||||
# 3. insert new data
|
# 3. insert new data
|
||||||
nb_new = 300
|
nb_new = 300
|
||||||
insert_ids_new = cf.insert_data(collection_w, nb_new,
|
_, _, _, insert_ids_new, time_stamp = cf.insert_data(collection_w, nb_new,
|
||||||
auto_id=auto_id, dim=dim, insert_offset=nb_old)[3]
|
auto_id=auto_id, dim=dim,
|
||||||
|
insert_offset=nb_old)
|
||||||
insert_ids.extend(insert_ids_new)
|
insert_ids.extend(insert_ids_new)
|
||||||
# gracefulTime is default as 1s which allows data
|
# gracefulTime is default as 1s which allows data
|
||||||
# could not be searched instantly in gracefulTime
|
# could not be searched instantly in gracefulTime
|
||||||
|
@ -1091,6 +1098,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:nq], default_search_field,
|
collection_w.search(vectors[:nq], default_search_field,
|
||||||
default_search_params, limit,
|
default_search_params, limit,
|
||||||
default_search_exp, _async=_async,
|
default_search_exp, _async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": nq,
|
check_items={"nq": nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -1105,7 +1113,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search successfully with limit(topK)
|
expected: search successfully with limit(topK)
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, 100,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, 100,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=max_dim)
|
dim=max_dim)
|
||||||
# 2. search
|
# 2. search
|
||||||
|
@ -1132,7 +1140,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search successfully with limit(topK)
|
expected: search successfully with limit(topK)
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, 5000,
|
collection_w, _, _, insert_ids, time_stamp = self.init_collection_general(prefix, True, 5000,
|
||||||
partition_num=1,
|
partition_num=1,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim, is_index=True)
|
dim=dim, is_index=True)
|
||||||
|
@ -1154,6 +1162,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:default_nq], default_search_field,
|
collection_w.search(vectors[:default_nq], default_search_field,
|
||||||
search_param, default_limit,
|
search_param, default_limit,
|
||||||
default_search_exp, _async=_async,
|
default_search_exp, _async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": default_nq,
|
check_items={"nq": default_nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -1171,7 +1180,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: searched successfully
|
expected: searched successfully
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, 5000,
|
collection_w, _, _, insert_ids, time_stamp = self.init_collection_general(prefix, True, 5000,
|
||||||
partition_num=1,
|
partition_num=1,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim, is_index=True)
|
dim=dim, is_index=True)
|
||||||
|
@ -1195,6 +1204,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:default_nq], default_search_field,
|
collection_w.search(vectors[:default_nq], default_search_field,
|
||||||
search_param, default_limit,
|
search_param, default_limit,
|
||||||
default_search_exp, _async=_async,
|
default_search_exp, _async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": default_nq,
|
check_items={"nq": default_nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -1209,7 +1219,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: searched successfully
|
expected: searched successfully
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
# 2. search for multiple times
|
# 2. search for multiple times
|
||||||
|
@ -1234,7 +1244,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search successfully with limit(topK)
|
expected: search successfully with limit(topK)
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, time_stamp = self.init_collection_general(prefix, True, nb,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
# 2. search
|
# 2. search
|
||||||
|
@ -1246,6 +1256,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:nq], default_search_field,
|
collection_w.search(vectors[:nq], default_search_field,
|
||||||
default_search_params, default_limit,
|
default_search_params, default_limit,
|
||||||
default_search_exp, _async=_async,
|
default_search_exp, _async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": nq,
|
check_items={"nq": nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -1308,7 +1319,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: searched successfully
|
expected: searched successfully
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, time_stamp = self.init_collection_general(prefix, True, nb,
|
||||||
partition_num=1,
|
partition_num=1,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
is_index=True)
|
is_index=True)
|
||||||
|
@ -1329,6 +1340,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:default_nq], default_search_field,
|
collection_w.search(vectors[:default_nq], default_search_field,
|
||||||
search_params, limit, default_search_exp,
|
search_params, limit, default_search_exp,
|
||||||
[par[1].name], _async=_async,
|
[par[1].name], _async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": default_nq,
|
check_items={"nq": default_nq,
|
||||||
"ids": insert_ids[par[0].num_entities:],
|
"ids": insert_ids[par[0].num_entities:],
|
||||||
|
@ -1343,7 +1355,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: searched successfully
|
expected: searched successfully
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
partition_num=1,
|
partition_num=1,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim,
|
dim=dim,
|
||||||
|
@ -1378,7 +1390,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: searched successfully
|
expected: searched successfully
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
partition_num=1,
|
partition_num=1,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
|
@ -1446,7 +1458,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: the return distance equals to the computed value
|
expected: the return distance equals to the computed value
|
||||||
"""
|
"""
|
||||||
# 1. initialize with binary data
|
# 1. initialize with binary data
|
||||||
collection_w, _, binary_raw_vector, insert_ids = self.init_collection_general(prefix, True, 2,
|
collection_w, _, binary_raw_vector, insert_ids, time_stamp = self.init_collection_general(prefix, True, 2,
|
||||||
is_binary=True,
|
is_binary=True,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim,
|
dim=dim,
|
||||||
|
@ -1464,6 +1476,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
res = collection_w.search(binary_vectors[:nq], "binary_vector",
|
res = collection_w.search(binary_vectors[:nq], "binary_vector",
|
||||||
search_params, default_limit, "int64 >= 0",
|
search_params, default_limit, "int64 >= 0",
|
||||||
_async=_async,
|
_async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": nq,
|
check_items={"nq": nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
@ -1483,7 +1496,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: the return distance equals to the computed value
|
expected: the return distance equals to the computed value
|
||||||
"""
|
"""
|
||||||
# 1. initialize with binary data
|
# 1. initialize with binary data
|
||||||
collection_w, _, binary_raw_vector, insert_ids = self.init_collection_general(prefix, True, 2,
|
collection_w, _, binary_raw_vector, insert_ids, _ = self.init_collection_general(prefix, True, 2,
|
||||||
is_binary=True,
|
is_binary=True,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim,
|
dim=dim,
|
||||||
|
@ -1521,7 +1534,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: the return distance equals to the computed value
|
expected: the return distance equals to the computed value
|
||||||
"""
|
"""
|
||||||
# 1. initialize with binary data
|
# 1. initialize with binary data
|
||||||
collection_w, _, binary_raw_vector, insert_ids = self.init_collection_general(prefix, True, 2,
|
collection_w, _, binary_raw_vector, insert_ids, _ = self.init_collection_general(prefix, True, 2,
|
||||||
is_binary=True,
|
is_binary=True,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim,
|
dim=dim,
|
||||||
|
@ -1560,7 +1573,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
nb = 1000
|
nb = 1000
|
||||||
collection_w, _vectors, _, insert_ids = self.init_collection_general(prefix, True,
|
collection_w, _vectors, _, insert_ids, _ = self.init_collection_general(prefix, True,
|
||||||
nb, dim=dim,
|
nb, dim=dim,
|
||||||
is_index=True)
|
is_index=True)
|
||||||
|
|
||||||
|
@ -1610,7 +1623,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
nb = 1000
|
nb = 1000
|
||||||
collection_w, _vectors, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
is_all_data_type=True,
|
is_all_data_type=True,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
|
@ -1663,7 +1676,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
nb = 1000
|
nb = 1000
|
||||||
collection_w, _vectors, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
auto_id=True,
|
auto_id=True,
|
||||||
dim=dim,
|
dim=dim,
|
||||||
is_index=True)
|
is_index=True)
|
||||||
|
@ -1710,7 +1723,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search success
|
expected: search success
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
is_all_data_type=True,
|
is_all_data_type=True,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
|
@ -1743,7 +1756,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search success
|
expected: search success
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
# 2. search
|
# 2. search
|
||||||
|
@ -1771,7 +1784,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search success
|
expected: search success
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True,
|
||||||
auto_id=auto_id)
|
auto_id=auto_id)
|
||||||
# 2. search
|
# 2. search
|
||||||
log.info("test_search_with_output_field: Searching collection %s" % collection_w.name)
|
log.info("test_search_with_output_field: Searching collection %s" % collection_w.name)
|
||||||
|
@ -1799,7 +1812,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search success
|
expected: search success
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
is_all_data_type=True,
|
is_all_data_type=True,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
|
@ -1831,7 +1844,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
expected: search success
|
expected: search success
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True,
|
||||||
auto_id=auto_id)
|
auto_id=auto_id)
|
||||||
# 2. search
|
# 2. search
|
||||||
log.info("test_search_with_output_field_wildcard: Searching collection %s" % collection_w.name)
|
log.info("test_search_with_output_field_wildcard: Searching collection %s" % collection_w.name)
|
||||||
|
@ -1863,7 +1876,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
for i in range(collection_num):
|
for i in range(collection_num):
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
log.info("test_search_multi_collections: search round %d" % (i + 1))
|
log.info("test_search_multi_collections: search round %d" % (i + 1))
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
# 2. search
|
# 2. search
|
||||||
|
@ -1889,7 +1902,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
threads_num = 10
|
threads_num = 10
|
||||||
threads = []
|
threads = []
|
||||||
collection_w, _, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, _, _, insert_ids, time_stamp = self.init_collection_general(prefix, True, nb,
|
||||||
auto_id=auto_id,
|
auto_id=auto_id,
|
||||||
dim=dim)
|
dim=dim)
|
||||||
|
|
||||||
|
@ -1898,6 +1911,7 @@ class TestCollectionSearch(TestcaseBase):
|
||||||
collection_w.search(vectors[:nq], default_search_field,
|
collection_w.search(vectors[:nq], default_search_field,
|
||||||
default_search_params, default_limit,
|
default_search_params, default_limit,
|
||||||
default_search_exp, _async=_async,
|
default_search_exp, _async=_async,
|
||||||
|
travel_timestamp=time_stamp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.check_search_results,
|
||||||
check_items={"nq": nq,
|
check_items={"nq": nq,
|
||||||
"ids": insert_ids,
|
"ids": insert_ids,
|
||||||
|
|
|
@ -470,7 +470,7 @@ class TestUtilityParams(TestcaseBase):
|
||||||
"""
|
"""
|
||||||
self._connect()
|
self._connect()
|
||||||
nb = 10
|
nb = 10
|
||||||
collection_w, vectors, _, insert_ids = self.init_collection_general(prefix, True, nb,
|
collection_w, vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb,
|
||||||
is_index=True)
|
is_index=True)
|
||||||
middle = len(insert_ids) // 2
|
middle = len(insert_ids) // 2
|
||||||
op_l = {"ids": insert_ids[:middle], "collection": collection_w.name,
|
op_l = {"ids": insert_ids[:middle], "collection": collection_w.name,
|
||||||
|
@ -1048,7 +1048,7 @@ class TestUtilityBase(TestcaseBase):
|
||||||
log.info("Creating connection")
|
log.info("Creating connection")
|
||||||
self._connect()
|
self._connect()
|
||||||
nb = 10
|
nb = 10
|
||||||
collection_w, vectors, _, insert_ids = self.init_collection_general(prefix, True, nb)
|
collection_w, vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb)
|
||||||
middle = len(insert_ids) // 2
|
middle = len(insert_ids) // 2
|
||||||
vectors = vectors[0].loc[:, default_field_name]
|
vectors = vectors[0].loc[:, default_field_name]
|
||||||
vectors_l = vectors[:middle]
|
vectors_l = vectors[:middle]
|
||||||
|
@ -1081,8 +1081,8 @@ class TestUtilityBase(TestcaseBase):
|
||||||
nb = 10
|
nb = 10
|
||||||
prefix_1 = "utility_distance"
|
prefix_1 = "utility_distance"
|
||||||
log.info("Creating two collections")
|
log.info("Creating two collections")
|
||||||
collection_w, vectors, _, insert_ids = self.init_collection_general(prefix, True, nb)
|
collection_w, vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb)
|
||||||
collection_w_1, vectors_1, _, insert_ids_1 = self.init_collection_general(prefix_1, True, nb)
|
collection_w_1, vectors_1, _, insert_ids_1, _ = self.init_collection_general(prefix_1, True, nb)
|
||||||
vectors_l = vectors[0].loc[:, default_field_name]
|
vectors_l = vectors[0].loc[:, default_field_name]
|
||||||
vectors_r = vectors_1[0].loc[:, default_field_name]
|
vectors_r = vectors_1[0].loc[:, default_field_name]
|
||||||
log.info("Extracting entities from collections for distance calculating")
|
log.info("Extracting entities from collections for distance calculating")
|
||||||
|
@ -1109,7 +1109,7 @@ class TestUtilityBase(TestcaseBase):
|
||||||
log.info("Creating connection")
|
log.info("Creating connection")
|
||||||
self._connect()
|
self._connect()
|
||||||
nb = 10
|
nb = 10
|
||||||
collection_w, vectors, _, insert_ids = self.init_collection_general(prefix, True, nb)
|
collection_w, vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb)
|
||||||
middle = len(insert_ids) // 2
|
middle = len(insert_ids) // 2
|
||||||
vectors = vectors[0].loc[:, default_field_name]
|
vectors = vectors[0].loc[:, default_field_name]
|
||||||
vectors_l = cf.gen_vectors(nb, default_dim)
|
vectors_l = cf.gen_vectors(nb, default_dim)
|
||||||
|
@ -1139,7 +1139,7 @@ class TestUtilityBase(TestcaseBase):
|
||||||
log.info("Creating connection")
|
log.info("Creating connection")
|
||||||
self._connect()
|
self._connect()
|
||||||
nb = 10
|
nb = 10
|
||||||
collection_w, vectors, _, insert_ids = self.init_collection_general(prefix, True, nb)
|
collection_w, vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb)
|
||||||
middle = len(insert_ids) // 2
|
middle = len(insert_ids) // 2
|
||||||
vectors = vectors[0].loc[:, default_field_name]
|
vectors = vectors[0].loc[:, default_field_name]
|
||||||
vectors_l = vectors[:middle]
|
vectors_l = vectors[:middle]
|
||||||
|
@ -1167,7 +1167,7 @@ class TestUtilityBase(TestcaseBase):
|
||||||
log.info("Creating connection")
|
log.info("Creating connection")
|
||||||
self._connect()
|
self._connect()
|
||||||
nb = 10
|
nb = 10
|
||||||
collection_w, vectors, _, insert_ids = self.init_collection_general(prefix, True, nb, partition_num=1)
|
collection_w, vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb, partition_num=1)
|
||||||
partitions = collection_w.partitions
|
partitions = collection_w.partitions
|
||||||
middle = len(insert_ids) // 2
|
middle = len(insert_ids) // 2
|
||||||
params = {metric_field: metric, "sqrt": sqrt}
|
params = {metric_field: metric, "sqrt": sqrt}
|
||||||
|
@ -1201,7 +1201,7 @@ class TestUtilityBase(TestcaseBase):
|
||||||
log.info("Create connection")
|
log.info("Create connection")
|
||||||
self._connect()
|
self._connect()
|
||||||
nb = 10
|
nb = 10
|
||||||
collection_w, vectors, _, insert_ids = self.init_collection_general(prefix, True, nb, partition_num=1)
|
collection_w, vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb, partition_num=1)
|
||||||
partitions = collection_w.partitions
|
partitions = collection_w.partitions
|
||||||
middle = len(insert_ids) // 2
|
middle = len(insert_ids) // 2
|
||||||
params = {metric_field: metric, "sqrt": sqrt}
|
params = {metric_field: metric, "sqrt": sqrt}
|
||||||
|
@ -1230,7 +1230,7 @@ class TestUtilityBase(TestcaseBase):
|
||||||
log.info("Creating connection")
|
log.info("Creating connection")
|
||||||
self._connect()
|
self._connect()
|
||||||
nb = 10
|
nb = 10
|
||||||
collection_w, vectors, _, insert_ids = self.init_collection_general(prefix, True, nb, partition_num=1)
|
collection_w, vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb, partition_num=1)
|
||||||
middle = len(insert_ids) // 2
|
middle = len(insert_ids) // 2
|
||||||
partitions = collection_w.partitions
|
partitions = collection_w.partitions
|
||||||
vectors_l = cf.gen_vectors(nb // 2, default_dim)
|
vectors_l = cf.gen_vectors(nb // 2, default_dim)
|
||||||
|
@ -1262,7 +1262,7 @@ class TestUtilityBase(TestcaseBase):
|
||||||
"""
|
"""
|
||||||
self._connect()
|
self._connect()
|
||||||
nb = 10
|
nb = 10
|
||||||
collection_w, vectors, _, insert_ids = self.init_collection_general(prefix, True, nb, partition_num=1)
|
collection_w, vectors, _, insert_ids, _ = self.init_collection_general(prefix, True, nb, partition_num=1)
|
||||||
middle = len(insert_ids) // 2
|
middle = len(insert_ids) // 2
|
||||||
partitions = collection_w.partitions
|
partitions = collection_w.partitions
|
||||||
vectors_r = cf.gen_vectors(nb // 2, default_dim)
|
vectors_r = cf.gen_vectors(nb // 2, default_dim)
|
||||||
|
|
Loading…
Reference in New Issue