Skip to content

Commit

Permalink
1520 - fix overwriting internal metadata by the collectors (#1521)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladysl authored Nov 22, 2023
1 parent bdd6e5d commit 69bd7b2
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.opendatadiscovery.oddplatform.dto.metadata.MetadataBinding;
import org.opendatadiscovery.oddplatform.dto.metadata.MetadataInfo;
import org.opendatadiscovery.oddplatform.dto.metadata.MetadataKey;
import org.opendatadiscovery.oddplatform.dto.metadata.MetadataOrigin;
import org.opendatadiscovery.oddplatform.dto.metadata.MetadataTypeEnum;
import org.opendatadiscovery.oddplatform.model.tables.pojos.MetadataFieldValuePojo;
import org.opendatadiscovery.oddplatform.repository.reactive.ReactiveMetadataFieldValueRepository;
Expand Down Expand Up @@ -39,11 +40,12 @@ public Mono<Void> process(final IngestionRequest request) {
.distinct()
.toList();

final var existingMono = metadataFieldValueRepository.listByDataEntityIds(request.getAllIds())
.collect(Collectors.toMap(
mf -> new MetadataBinding(mf.getDataEntityId(), mf.getMetadataFieldId()),
identity()
));
final var existingMono =
metadataFieldValueRepository.listByDataEntityIds(request.getAllIds(), MetadataOrigin.EXTERNAL)
.collect(Collectors.toMap(
mf -> new MetadataBinding(mf.getDataEntityId(), mf.getMetadataFieldId()),
identity()
));
return metadataFieldService.ingestMetadataFields(metadataKeys)
.zipWith(existingMono)
.flatMap(function((allMetadataFields, existingMetadataValues) -> {
Expand Down

0 comments on commit 69bd7b2

Please sign in to comment.