I have the below code where the Id is a 36 character GUID. The code gets executed but when a matching record is found , instead of updating it inserts the entire records again. What could be the root cause for this?
delta_table.alias("target").merge( deduped_df.alias("source"), "trim(upper(target.Id)) = trim(upper(source.dId)) " ).whenMatchedUpdate( set={ "Id" : "source.dId", "EntityId" : "source.EntityId", "PropertyName" : "source.PropertyName", "ValueString":"source.ValueString", "ValueInt" : "source.ValueInt", "ValueDecimal" : "source.ValueDecimal", "ValueBit" : "source.ValueBit", "ValidFrom" : "source.ValidFrom", "ValidTo" : "source.ValidTo", "Description" : "source.Description", "ModifiedBy" : "source.ModifiedBy", "CreatedAt" : "source.CreatedAt", "CreatedBy" : "source.CreatedBy", "Active" : "source.Active", "Saved" : "source.Saved", "ETL_UpdateDate" : "source.ETL_UpdateDate", "ETL_Source" : "source.ETL_Source" }).whenNotMatchedInsert(values={ "Id" : "source.dId", "EntityId" : "source.EntityId", "PropertyName" : "source.PropertyName", "ValueString":"source.ValueString", "ValueInt" : "source.ValueInt", "ValueDecimal" : "source.ValueDecimal", "ValueBit" : "source.ValueBit", "ValidFrom" : "source.ValidFrom", "ValidTo" : "source.ValidTo", "Description" : "source.Description", "ModifiedBy" : "source.ModifiedBy", "CreatedAt" : "source.CreatedAt", "CreatedBy" : "source.CreatedBy", "Active" : "source.Active", "Saved" : "source.Saved", "ETL_UpdateDate" : "source.ETL_UpdateDate", "ETL_LoadDate" : "source.ETL_LoadDate", "ETL_Source" : "source.ETL_Source" }).execute()