Hi @Gilg , The APPLY_CHANGES
The command does not directly handle schema evolution. However, the underlying MERGE INTO
operation, which is used in the APPLY_CHANGES
. The command supports automatic schema evolution. This allows users to resolve schema mismatches between the target and source table in a merge operation.
The schema evolution handles two cases:
1. A column in the source table is absent in the target table. In this case, the new column is added to the target schema and its values are inserted or updated using the source values.
2. A column in the target table is not present in the source table.
In this case, the target schema is left unchanged; the values in the additional target column are either left unchanged (for UPDATE
) or set to NULL
(for INSERT
).
To use schema evolution, you must set the Spark session configuration spark.databricks.delta.schema.autoMerge.enabled
to true
Before you run the merge
command.
However, it's important to note that in DBR 7.3 LTS, merge
supports schema evolution of only top-level columns and not of nested columns.