diff --git a/python/python/tests/test_permutation.py b/python/python/tests/test_permutation.py index 0da12c7dc..f246982cf 100644 --- a/python/python/tests/test_permutation.py +++ b/python/python/tests/test_permutation.py @@ -128,21 +128,30 @@ def test_split_hash(mem_db): def test_split_hash_with_discard(mem_db): """Test hash-based splitting with discard weight.""" + total_rows = 1000 tbl = mem_db.create_table( "test_table", - pa.table({"id": range(100), "category": ["A", "B"] * 50, "value": range(100)}), + pa.table( + { + "id": range(total_rows), + "category": [f"category-{i}" for i in range(total_rows)], + "value": range(total_rows), + } + ), ) permutation_tbl = ( permutation_builder(tbl) - .split_hash(["category"], [1, 1], discard_weight=2) # Should discard ~50% + .split_hash(["id"], [1, 1], discard_weight=2) # Should discard ~50% .execute() ) - # Should have fewer than 100 rows due to discard + # Should have fewer rows due to discard, but should not be empty. row_count = permutation_tbl.count_rows() - assert row_count < 100 - assert row_count > 0 # But not empty + assert 0 < row_count < total_rows + + data = permutation_tbl.search(None).to_arrow().to_pydict() + assert set(data["split_id"]) == {0, 1} def test_split_sequential(mem_db): diff --git a/python/python/tests/test_query.py b/python/python/tests/test_query.py index 62ee6e1eb..6840be052 100644 --- a/python/python/tests/test_query.py +++ b/python/python/tests/test_query.py @@ -1273,7 +1273,7 @@ async def test_explain_plan_fts(table_async: AsyncTable): query = await table_async.search("dog", query_type="fts", fts_columns="text") plan = await query.explain_plan() # Should show FTS details (issue #2465 is now fixed) - assert "MatchQuery: column=text, query=dog" in plan + assert "MatchQuery: column=text, query=[dog]" in plan assert "GlobalLimitExec" in plan # Default limit # Test FTS query with limit @@ -1281,7 +1281,7 @@ async def test_explain_plan_fts(table_async: AsyncTable): "dog", query_type="fts", fts_columns="text" ) plan_with_limit = await query_with_limit.limit(1).explain_plan() - assert "MatchQuery: column=text, query=dog" in plan_with_limit + assert "MatchQuery: column=text, query=[dog]" in plan_with_limit assert "GlobalLimitExec: skip=0, fetch=1" in plan_with_limit # Test FTS query with offset and limit @@ -1289,7 +1289,7 @@ async def test_explain_plan_fts(table_async: AsyncTable): "dog", query_type="fts", fts_columns="text" ) plan_with_offset = await query_with_offset.offset(1).limit(1).explain_plan() - assert "MatchQuery: column=text, query=dog" in plan_with_offset + assert "MatchQuery: column=text, query=[dog]" in plan_with_offset assert "GlobalLimitExec: skip=1, fetch=1" in plan_with_offset @@ -1333,7 +1333,7 @@ async def test_explain_plan_with_filters(table_async: AsyncTable): "dog", query_type="fts", fts_columns="text" ) plan_fts_filter = await query_fts_filter.where("id = 1").explain_plan() - assert "MatchQuery: column=text, query=dog" in plan_fts_filter + assert "MatchQuery: column=text, query=[dog]" in plan_fts_filter assert "LanceRead" in plan_fts_filter assert "full_filter=id = Int64(1)" in plan_fts_filter # Should show filter details