open-metadata / OpenMetadata

OpenMetadata is a unified metadata platform for data discovery, data observability, and data governance powered by a central metadata repository, in-depth column level lineage, and seamless team collaboration.
https://open-metadata.org
Apache License 2.0
5.26k stars 994 forks source link

fix owners patch issue #17900

Closed mohityadav766 closed 1 week ago

mohityadav766 commented 1 week ago

Describe your changes:

Fixes Owner Patch Issue :-

if (nullOrEmpty(owners)) {
       return;
     }
     // populate owner entityRefs with all fields
     List<EntityReference> refs = validateOwners(owners);
     if (nullOrEmpty(refs)) {
       return;
     }
     refs.sort(Comparator.comparing(EntityReference::getName));
     owners.sort(Comparator.comparing(EntityReference::getName));

     for (int i = 0; i < owners.size(); i++) {
       EntityUtil.copy(refs.get(i), owners.get(i));
     }

The issue above is we have the populated details in refs , but we again copy the ref from owners , which can run into issue , since it can only have id and type . For example owner.sort will itself run into issues , if the id and type are only supplied and we are trying to sort on name

#

Type of change:

#

Checklist: