Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Maurya <[email protected]>
rishabhmaurya committed Jun 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 4baf532 commit 1d79fa8
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -95,16 +95,18 @@ public DerivedFieldType resolve(String fieldName) {
}

private DerivedFieldType resolveUsingSearchDefinitions(String fieldName) {
if (derivedFieldTypeMap.containsKey(fieldName)) {
return derivedFieldTypeMap.get(fieldName);
}
// resolve and cache nested derived field
DerivedFieldType parentDerivedField = (DerivedFieldType) getParentDerivedField(fieldName);
if (parentDerivedField != null) {
return derivedFieldTypeMap.computeIfAbsent(fieldName, f -> this.resolveNestedField(f, parentDerivedField));
} else {
return null;
}
return Optional.ofNullable(derivedFieldTypeMap.get(fieldName))
.orElseGet(
() -> Optional.ofNullable((DerivedFieldType) getParentDerivedField(fieldName))
.map(
// compute and cache nested derived field
parentDerivedField -> derivedFieldTypeMap.computeIfAbsent(
fieldName,
f -> this.resolveNestedField(f, parentDerivedField)
)
)
.orElse(null)
);
}

private DerivedFieldType resolveNestedField(String fieldName, DerivedFieldType parentDerivedField) {

0 comments on commit 1d79fa8

Please sign in to comment.