From 8dcde34f181013701de4efe234598a185afac130 Mon Sep 17 00:00:00 2001 From: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 17:45:59 +0000 Subject: [PATCH] test(python): cover search after schema merge --- python/python/tests/test_table.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/python/python/tests/test_table.py b/python/python/tests/test_table.py index 542c944c8..974ccb55a 100644 --- a/python/python/tests/test_table.py +++ b/python/python/tests/test_table.py @@ -2109,6 +2109,37 @@ def test_merge(tmp_db: DBConnection, tmp_path): table.merge(other_dataset, left_on="id") +def test_search_after_merge(tmp_db: DBConnection): + pytest.importorskip("lance") + pd = pytest.importorskip("pandas") + + rng = np.random.default_rng(42) + row_count = 512 + vectors = rng.standard_normal((row_count, 8)).astype(np.float32) + table = tmp_db.create_table( + "search_after_merge", + data=pd.DataFrame( + { + "id": [str(i) for i in range(row_count)], + "vector": list(vectors), + } + ), + ) + table.create_index("vector", config=IvfPq(num_partitions=1, num_sub_vectors=2)) + + links = pd.DataFrame( + { + "id": [str(i) for i in range(row_count // 2)], + "link": [f"https://example.com/{i}" for i in range(row_count // 2)], + } + ) + table.merge(links, left_on="id") + + result = table.search(vectors[-1]).refine_factor(50).limit(10).to_arrow() + links_by_id = dict(zip(result["id"].to_pylist(), result["link"].to_pylist())) + assert links_by_id[str(row_count - 1)] is None + + def test_delete(mem_db: DBConnection): table = mem_db.create_table( "my_table",