sheetalshah1007 commented on code in PR #478:
URL: https://github.com/apache/atlas/pull/478#discussion_r3080735282


##########
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java:
##########
@@ -1533,6 +1532,98 @@ private void mapRelationshipAttributes(AtlasEntity 
entity, AtlasEntityType entit
         LOG.debug("<== mapRelationshipAttributes({}, {})", op, 
entity.getTypeName());
     }
 
+    private void mapRelationshipAttributeWithMultipleTypes(AtlasEntity entity, 
AtlasEntityType entityType, String attrName, Object attrValue, AtlasVertex 
vertex, EntityOperation op, EntityMutationContext context) throws 
AtlasBaseException {
+        LOG.debug("==> mapRelationshipAttributeWithMultipleTypes({}, {})", 
attrName, entity.getTypeName());
+        Set<String> relationshipTypeNames = 
entityType.getAttributeRelationshipTypes(attrName);
+
+        if (CollectionUtils.isEmpty(relationshipTypeNames)) {

Review Comment:
   **Empty relationshipTypeNames:**
   `relationshipTypeNames` comes from 
`getAttributeRelationshipTypes(attrName)`. When it is empty or null, it means 
we cannot run the new “split by relationship type and map each group” logic — 
there are no registered relationship-type keys to split on.
   That does not mean there is nothing to store. The entity can still carry 
relationship-attribute values in the request. We still need to write those to 
the graph.
   In that case we use the same behaviour as before this multi-type change: 
resolve the relationship type from the value` 
(AtlasEntityUtil.getRelationshipType(attrValue))`, resolve 
`getRelationshipAttribute(attrName, relationType)`, and call `mapAttribute` 
once. So “empty `relationshipTypeNames`” means “no multi-type split,” not “skip 
mapping.” ; we still map using the legacy resolution path.
   
   **Added branch for default behavior:**
   If exactly one relationship type and `attrValue` is not a `Collection` and 
not a `Map`: use that sole type from the registry and `mapAttribute` once 
(default for a single ref). Comment explains map-shaped single refs skip this 
and go to else.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to