Skip to content

Commit 9e60c33

Browse files
committed
add test for writing out of order schema
1 parent d7356f9 commit 9e60c33

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/integration/test_writes/test_writes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,3 +925,17 @@ def table_write_subset_of_schema(session_catalog: Catalog, arrow_table_with_null
925925
tbl.append(arrow_table_without_some_columns)
926926
# overwrite and then append should produce twice the data
927927
assert len(tbl.scan().to_arrow()) == len(arrow_table_without_some_columns) * 2
928+
929+
930+
@pytest.mark.parametrize("format_version", [1, 2])
931+
def table_write_out_of_order_schema(session_catalog: Catalog, arrow_table_with_null: pa.Table, format_version: int) -> None:
932+
import random
933+
identifier = "default.table_write_out_of_order_schema"
934+
shuffled_schema = pa.schema(random.shuffle(arrow_table_with_null.schema))
935+
936+
tbl = _create_table(session_catalog, identifier, {"format-version": format_version}, schema=shuffled_schema)
937+
938+
tbl.overwrite(arrow_table_with_null)
939+
tbl.append(arrow_table_with_null)
940+
# overwrite and then append should produce twice the data
941+
assert len(tbl.scan().to_arrow()) == len(arrow_table_with_null) * 2

0 commit comments

Comments
 (0)