Skip to content

Commit

Permalink
preload properties just once for a vertex
Browse files Browse the repository at this point in the history
  • Loading branch information
sriram-atlan committed Mar 5, 2025
1 parent ed824b2 commit 6a0810b
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,13 @@ public AtlasObjectId toAtlasObjectId(AtlasVertex entityVertex) throws AtlasBaseE
String typeName = entityVertex.getProperty(Constants.TYPE_NAME_PROPERTY_KEY, String.class);
AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName);
boolean enableJanusOptimisation = AtlasConfiguration.ATLAS_INDEXSEARCH_ENABLE_JANUS_OPTIMISATION_FOR_RELATIONS.getBoolean();

Map<String, Object> referenceVertexProperties = null;
if (entityType != null) {
Map<String, Object> uniqueAttributes = new HashMap<>();

Set<String> relationAttributes = RequestContext.get().getRelationAttrsForSearch();
if (enableJanusOptimisation) {
referenceVertexProperties = preloadProperties(entityVertex, entityType, relationAttributes);
}
for (AtlasAttribute attribute : entityType.getUniqAttributes().values()) {
Object attrValue = getVertexAttribute(entityVertex, attribute);

Expand All @@ -299,12 +302,7 @@ public AtlasObjectId toAtlasObjectId(AtlasVertex entityVertex) throws AtlasBaseE
}

Map<String, Object> attributes = new HashMap<>();
Set<String> relationAttributes = RequestContext.get().getRelationAttrsForSearch();
if (CollectionUtils.isNotEmpty(relationAttributes)) {
Map<String, Object> referenceVertexProperties = null;
if (enableJanusOptimisation) {
referenceVertexProperties = preloadProperties(entityVertex, entityType, relationAttributes);
}
for (String attributeName : relationAttributes) {
AtlasAttribute attribute = entityType.getAttribute(attributeName);
if (attribute != null
Expand Down

0 comments on commit 6a0810b

Please sign in to comment.