diff --git a/python/tests/test_writer.py b/python/tests/test_writer.py index 9252dfdd41..e210f0d4a0 100644 --- a/python/tests/test_writer.py +++ b/python/tests/test_writer.py @@ -1251,3 +1251,24 @@ def test_with_deltalake_schema(tmp_path: pathlib.Path, sample_data: pa.Table): ) delta_table = DeltaTable(tmp_path) assert delta_table.schema().to_pyarrow() == sample_data.schema + + +def test_write_stats_empty_rowgroups_2169(tmp_path: pathlib.Path): + data = pa.table( + { + "data": pa.array(["B"] * 1024 * 33), + } + ) + write_deltalake( + tmp_path, + data, + max_rows_per_file=1024 * 32, + max_rows_per_group=1024 * 16, + min_rows_per_group=8 * 1024, + mode="overwrite", + ) + dt = DeltaTable(tmp_path) + assert ( + dt.to_pyarrow_dataset().to_table(filter=(pc.field("data") == "B")).shape[0] + == 33792 + )