mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 10:26:09 +00:00
Co-authored-by: IceS2 <pjt1991@gmail.com>
This commit is contained in:
parent
1dab7c2b4e
commit
0af5e7af32
@ -13,6 +13,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.glassfish.jersey.internal.util.ExceptionUtils;
|
import org.glassfish.jersey.internal.util.ExceptionUtils;
|
||||||
import org.openmetadata.common.utils.CommonUtil;
|
import org.openmetadata.common.utils.CommonUtil;
|
||||||
@ -173,7 +174,9 @@ public class DataInsightsEntityEnricherProcessor
|
|||||||
entityMap.put("descriptionSources", processDescriptionSources(entity, changeSummaryMap));
|
entityMap.put("descriptionSources", processDescriptionSources(entity, changeSummaryMap));
|
||||||
|
|
||||||
// Process Tag Source
|
// Process Tag Source
|
||||||
entityMap.put("tagSources", processTagSources(entity));
|
TagAndTierSources tagAndTierSources = processTagAndTierSources(entity);
|
||||||
|
entityMap.put("tagSources", tagAndTierSources.getTagSources());
|
||||||
|
entityMap.put("tierSources", tagAndTierSources.getTierSources());
|
||||||
|
|
||||||
// Process Team
|
// Process Team
|
||||||
Optional.ofNullable(processTeam(entity)).ifPresent(team -> entityMap.put("team", team));
|
Optional.ofNullable(processTeam(entity)).ifPresent(team -> entityMap.put("team", team));
|
||||||
@ -299,37 +302,50 @@ public class DataInsightsEntityEnricherProcessor
|
|||||||
return team;
|
return team;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processTagSources(List<TagLabel> tagList, Map<String, Integer> tagSources) {
|
private void processTagAndTierSources(
|
||||||
|
List<TagLabel> tagList, TagAndTierSources tagAndTierSources) {
|
||||||
Optional.ofNullable(tagList)
|
Optional.ofNullable(tagList)
|
||||||
.ifPresent(
|
.ifPresent(
|
||||||
tags -> {
|
tags -> {
|
||||||
tags.stream()
|
tags.forEach(
|
||||||
.filter(tag -> !tag.getTagFQN().startsWith("Tier."))
|
tag -> {
|
||||||
.map(tag -> tag.getLabelType().value())
|
String tagSource = tag.getLabelType().value();
|
||||||
.forEach(
|
if (tag.getTagFQN().startsWith("Tier.")) {
|
||||||
tagSource ->
|
tagAndTierSources
|
||||||
tagSources.put(tagSource, tagSources.getOrDefault(tagSource, 0) + 1));
|
.getTierSources()
|
||||||
|
.put(
|
||||||
|
tagSource,
|
||||||
|
tagAndTierSources.getTierSources().getOrDefault(tagSource, 0) + 1);
|
||||||
|
} else {
|
||||||
|
tagAndTierSources
|
||||||
|
.getTagSources()
|
||||||
|
.put(
|
||||||
|
tagSource,
|
||||||
|
tagAndTierSources.getTagSources().getOrDefault(tagSource, 0) + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processEntityTagSources(EntityInterface entity, Map<String, Integer> tagSources) {
|
private void processEntityTagSources(
|
||||||
processTagSources(entity.getTags(), tagSources);
|
EntityInterface entity, TagAndTierSources tagAndTierSources) {
|
||||||
|
processTagAndTierSources(entity.getTags(), tagAndTierSources);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processColumnTagSources(
|
private void processColumnTagSources(
|
||||||
ColumnsEntityInterface entity, Map<String, Integer> tagSources) {
|
ColumnsEntityInterface entity, TagAndTierSources tagAndTierSources) {
|
||||||
for (Column column : entity.getColumns()) {
|
for (Column column : entity.getColumns()) {
|
||||||
processTagSources(column.getTags(), tagSources);
|
processTagAndTierSources(column.getTags(), tagAndTierSources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Integer> processTagSources(EntityInterface entity) {
|
private TagAndTierSources processTagAndTierSources(EntityInterface entity) {
|
||||||
Map<String, Integer> tagSources = new HashMap<>();
|
TagAndTierSources tagAndTierSources = new TagAndTierSources();
|
||||||
processEntityTagSources(entity, tagSources);
|
processEntityTagSources(entity, tagAndTierSources);
|
||||||
if (hasColumns(entity)) {
|
if (hasColumns(entity)) {
|
||||||
processColumnTagSources((ColumnsEntityInterface) entity, tagSources);
|
processColumnTagSources((ColumnsEntityInterface) entity, tagAndTierSources);
|
||||||
}
|
}
|
||||||
return tagSources;
|
return tagAndTierSources;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String processTier(EntityInterface entity) {
|
private String processTier(EntityInterface entity) {
|
||||||
@ -395,4 +411,15 @@ public class DataInsightsEntityEnricherProcessor
|
|||||||
public StepStats getStats() {
|
public StepStats getStats() {
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public static class TagAndTierSources {
|
||||||
|
private final Map<String, Integer> tagSources;
|
||||||
|
private final Map<String, Integer> tierSources;
|
||||||
|
|
||||||
|
public TagAndTierSources() {
|
||||||
|
this.tagSources = new HashMap<>();
|
||||||
|
this.tierSources = new HashMap<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user