Skip to content

Commit

Permalink
fix: set large_dtypes=False as the default behavior on merge
Browse files Browse the repository at this point in the history
Automatic upcasting of the data type is surprising and unexpected for
users. IMHO we should not be casting data types unless required
  • Loading branch information
rtyler committed Jul 3, 2024
1 parent b871cbd commit 9370151
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/deltalake/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ def merge(
target_alias: Optional[str] = None,
error_on_type_mismatch: bool = True,
writer_properties: Optional[WriterProperties] = None,
large_dtypes: bool = True,
large_dtypes: bool = False,
custom_metadata: Optional[Dict[str, str]] = None,
) -> "TableMerger":
"""Pass the source data which you want to merge on the target delta table, providing a
Expand Down
7 changes: 4 additions & 3 deletions python/tests/test_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,17 +970,18 @@ def test_struct_casting(tmp_path: pathlib.Path):
assert not df.empty

schema = pa.Table.from_pandas(df=df).schema

dt = DeltaTable.create(tmp_path, schema, name="test")
metadata = dt.metadata()
assert metadata.name == "test"

result = (
dt.merge(
source=df_merge, predicate="t.id = s.id", source_alias="s", target_alias="t"
source=df_merge,
predicate="t.id = s.id",
source_alias="s",
target_alias="t",
)
.when_matched_update_all()
.when_not_matched_insert_all()
.execute()
)
assert result is not None

0 comments on commit 9370151

Please sign in to comment.