Skip to content

Commit ac3dbbf

Browse files
author
Nikos Papailiou
committed
Add test for testing updates with uint64 ids
1 parent 3a3426f commit ac3dbbf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apis/python/test/test_ingestion.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from tiledb.cloud.dag import Mode
1010

1111
MINIMUM_ACCURACY = 0.85
12+
MAX_UINT64 = np.iinfo(np.dtype("uint64")).max
1213

1314

1415
def test_flat_ingestion_u8(tmp_path):
@@ -307,11 +308,12 @@ def test_ivf_flat_ingestion_with_updates(tmp_path):
307308
_, result = index.query(query_vectors, k=k, nprobe=nprobe)
308309
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
309310

311+
update_ids_offset = MAX_UINT64-size
310312
updated_ids = {}
311313
for i in range(100):
312314
index.delete(external_id=i)
313-
index.update(vector=data[i].astype(dtype), external_id=i + 1000000)
314-
updated_ids[i + 1000000] = i
315+
index.update(vector=data[i].astype(dtype), external_id=i + update_ids_offset)
316+
updated_ids[i + update_ids_offset] = i
315317

316318
_, result = index.query(query_vectors, k=k, nprobe=nprobe)
317319
assert accuracy(result, gt_i, updated_ids=updated_ids) > MINIMUM_ACCURACY
@@ -346,9 +348,10 @@ def test_ivf_flat_ingestion_with_batch_updates(tmp_path):
346348

347349
update_ids = {}
348350
updated_ids = {}
351+
update_ids_offset = MAX_UINT64 - size
349352
for i in range(0, 100000, 2):
350-
update_ids[i] = i + 1000000
351-
updated_ids[i + 1000000] = i
353+
update_ids[i] = i + update_ids_offset
354+
updated_ids[i + update_ids_offset] = i
352355
external_ids = np.zeros((len(update_ids) * 2), dtype=np.uint64)
353356
updates = np.empty((len(update_ids) * 2), dtype='O')
354357
id = 0

0 commit comments

Comments
 (0)