mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-02 13:43:22 +00:00
Fix Add Derived Tags while batch fetching (#20716)
This commit is contained in:
parent
0d3f747a1d
commit
ec5c83441a
@ -4156,7 +4156,11 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
||||
|
||||
if (targetFQN != null) {
|
||||
TagLabel tagLabel = tagFQNLabelMap.get(tagWithHash.getTagFQN());
|
||||
tagsMap.computeIfAbsent(targetFQN, k -> new ArrayList<>()).add(tagLabel);
|
||||
if (tagLabel != null) {
|
||||
tagsMap.computeIfAbsent(targetFQN, k -> new ArrayList<>()).add(tagLabel);
|
||||
} else {
|
||||
LOG.warn("Missing TagLabel for TagFQN in batch Fetch Tags: {}", tagWithHash.getTagFQN());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
@ -105,14 +106,18 @@ public class TagLabelUtil {
|
||||
return tagLabels;
|
||||
}
|
||||
|
||||
// Filter out all the derived tags
|
||||
List<TagLabel> filteredTags =
|
||||
tagLabels.stream().filter(tag -> tag.getLabelType() != TagLabel.LabelType.DERIVED).toList();
|
||||
tagLabels.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(tag -> tag.getLabelType() != TagLabel.LabelType.DERIVED)
|
||||
.toList();
|
||||
|
||||
List<TagLabel> updatedTagLabels = new ArrayList<>();
|
||||
EntityUtil.mergeTags(updatedTagLabels, filteredTags);
|
||||
for (TagLabel tagLabel : tagLabels) {
|
||||
EntityUtil.mergeTags(updatedTagLabels, getDerivedTags(tagLabel));
|
||||
if (tagLabel != null) {
|
||||
EntityUtil.mergeTags(updatedTagLabels, getDerivedTags(tagLabel));
|
||||
}
|
||||
}
|
||||
updatedTagLabels.sort(compareTagLabel);
|
||||
return updatedTagLabels;
|
||||
|
Loading…
x
Reference in New Issue
Block a user