Skip to content

Commit

Permalink
added a check for generated exp in schema evolution
Browse files Browse the repository at this point in the history
Signed-off-by: JustinRush80 <[email protected]>
  • Loading branch information
JustinRush80 committed Jan 27, 2025
1 parent 832848e commit 7dab953
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions python/tests/test_generated_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,34 @@ def test_merge_with_g_during_schema_evolution(
assert table_with_gc.to_pyarrow_table() == expected_data


def test_raise_when_gc_passed_merge_statement_during_schema_evolution(
tmp_path, data_without_gc, valid_gc_data
):
write_deltalake(
tmp_path,
mode="append",
data=data_without_gc,
)
dt = DeltaTable(tmp_path)
assert dt.protocol().min_writer_version == 2

with pytest.raises(
SchemaMismatchError,
match="Schema evolved fields cannot have generated expressions. Recreate the table to achieve this.",
):
(
dt.merge(
valid_gc_data,
predicate="s.id = t.id",
source_alias="s",
target_alias="t",
merge_schema=True,
)
.when_not_matched_insert_all()
.execute()
)


def test_merge_with_gc_invalid(table_with_gc: DeltaTable, invalid_gc_data):
import re

Expand Down

0 comments on commit 7dab953

Please sign in to comment.