Skip to content

Commit 397e31e

Browse files
committed
add test for writing out of order schema
1 parent f2949b7 commit 397e31e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/integration/test_writes/test_writes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,20 @@ def table_write_subset_of_schema(session_catalog: Catalog, arrow_table_with_null
975975
assert len(tbl.scan().to_arrow()) == len(arrow_table_without_some_columns) * 2
976976

977977

978+
@pytest.mark.parametrize("format_version", [1, 2])
979+
def table_write_out_of_order_schema(session_catalog: Catalog, arrow_table_with_null: pa.Table, format_version: int) -> None:
980+
import random
981+
identifier = "default.table_write_out_of_order_schema"
982+
shuffled_schema = pa.schema(random.shuffle(arrow_table_with_null.schema))
983+
984+
tbl = _create_table(session_catalog, identifier, {"format-version": format_version}, schema=shuffled_schema)
985+
986+
tbl.overwrite(arrow_table_with_null)
987+
tbl.append(arrow_table_with_null)
988+
# overwrite and then append should produce twice the data
989+
assert len(tbl.scan().to_arrow()) == len(arrow_table_with_null) * 2
990+
991+
978992
@pytest.mark.integration
979993
@pytest.mark.parametrize("format_version", [1, 2])
980994
def test_write_all_timestamp_precision(mocker: MockerFixture, session_catalog: Catalog, format_version: int) -> None:

0 commit comments

Comments
 (0)