Skip to content

Commit 1ae7f1a

Browse files
authored
Bug fix (#587)
1 parent 0732056 commit 1ae7f1a

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

dao-api/src/main/java/com/linkedin/metadata/dao/BaseLocalDAO.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -736,11 +736,14 @@ <ASPECT_UNION extends RecordTemplate> URN createAspectsWithCallbacks(@Nonnull UR
736736
}
737737
}
738738

739-
// check if any the aspects are in test mode
740-
boolean isTestModeFalseForAll = aspectCreateLambdas.stream().filter(aspectCreateLambda -> aspectCreateLambda.getIngestionParams().isTestMode()).collect(
741-
Collectors.toList()).isEmpty();
742-
743-
int numRows = createNewAssetWithAspects(urn, aspectCreateLambdas, aspectValues, auditStamp, trackingContext, isTestModeFalseForAll);
739+
// Check if any of the aspects are in test mode
740+
// Assumption: Either all aspects will be in test mode OR all aspects will be in non-test mode.
741+
// We check if the filtered list (aspects with test mode = true) is empty to determine if all are non-test mode.
742+
boolean isTestModeFalseForAll = aspectCreateLambdas.stream()
743+
.noneMatch(aspectCreateLambda -> aspectCreateLambda.getIngestionParams().isTestMode());
744+
745+
// Create the asset with aspects. Pass the negation since createNewAssetWithAspects expects isTestMode flag.
746+
int numRows = createNewAssetWithAspects(urn, aspectCreateLambdas, aspectValues, auditStamp, trackingContext, !isTestModeFalseForAll);
744747
for (RecordTemplate aspectValue : aspectValues) {
745748
// For each aspect, we need to trigger emit MAE
746749
// In new asset creation, old value is null

0 commit comments

Comments
 (0)