Skip to content

Commit aa361d1

Browse files
authored
Test, write subset of schema (#704)
1 parent d02d7a1 commit aa361d1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/integration/test_writes/test_writes.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,3 +857,15 @@ def test_sanitize_character_partitioned(catalog: Catalog) -> None:
857857
)
858858

859859
assert len(tbl.scan().to_arrow()) == 22
860+
861+
862+
@pytest.mark.parametrize("format_version", [1, 2])
863+
def table_write_subset_of_schema(session_catalog: Catalog, arrow_table_with_null: pa.Table, format_version: int) -> None:
864+
identifier = "default.table_append_subset_of_schema"
865+
tbl = _create_table(session_catalog, identifier, {"format-version": format_version}, [arrow_table_with_null])
866+
arrow_table_without_some_columns = arrow_table_with_null.combine_chunks().drop(arrow_table_with_null.column_names[0])
867+
assert len(arrow_table_without_some_columns.columns) < len(arrow_table_with_null.columns)
868+
tbl.overwrite(arrow_table_without_some_columns)
869+
tbl.append(arrow_table_without_some_columns)
870+
# overwrite and then append should produce twice the data
871+
assert len(tbl.scan().to_arrow()) == len(arrow_table_without_some_columns) * 2

0 commit comments

Comments
 (0)