Skip to content

Commit 6420027

Browse files
committed
fix: verify that the table itself remains the same before/after compaction in test_maintenance_compact()
1 parent 2774bd3 commit 6420027

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/table/test_maintenance.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def test_maintenance_compact(catalog: Catalog) -> None:
6363
# Verify state before compaction
6464
before_files = list(table.scan().plan_files())
6565
assert len(before_files) == 12
66-
assert table.scan().to_arrow().num_rows == 120
66+
arrow_table_before = table.scan().to_arrow()
67+
assert arrow_table_before.num_rows == 120
6768

6869
# Execute Compaction
6970
table.maintenance.compact()
@@ -72,7 +73,13 @@ def test_maintenance_compact(catalog: Catalog) -> None:
7273
table.refresh()
7374
after_files = list(table.scan().plan_files())
7475
assert len(after_files) == 3 # Should be 1 optimized data file per partition
75-
assert table.scan().to_arrow().num_rows == 120
76+
77+
arrow_table_after = table.scan().to_arrow()
78+
assert arrow_table_after.num_rows == 120
79+
assert arrow_table_before.column_names == arrow_table_after.column_names
80+
assert sorted(arrow_table_before.to_pylist(), key=lambda x: x["id"]) == sorted(
81+
arrow_table_after.to_pylist(), key=lambda x: x["id"]
82+
)
7683

7784
# Ensure snapshot properties specify the replace-operation
7885
new_snapshot = table.current_snapshot()

0 commit comments

Comments
 (0)