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


##########
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java:
##########
@@ -1498,29 +1498,28 @@ private void mapAttributes(AtlasStruct struct, 
AtlasStructType structType, Atlas
         LOG.debug("<== mapAttributes({}, {})", op, struct.getTypeName());
     }
 
-    private void mapRelationshipAttributes(AtlasEntity entity, AtlasEntityType 
entityType, AtlasVertex vertex, EntityOperation op, EntityMutationContext 
context) throws AtlasBaseException {
+    private void mapRelationshipAttributes(AtlasEntity entity, AtlasEntityType 
entityType, AtlasVertex vertex, EntityOperation op,
+            EntityMutationContext context) throws AtlasBaseException {
         LOG.debug("==> mapRelationshipAttributes({}, {})", op, 
entity.getTypeName());
 
         if (MapUtils.isNotEmpty(entity.getRelationshipAttributes())) {
             MetricRecorder metric = 
RequestContext.get().startMetricRecord("mapRelationshipAttributes");
 
             if (op.equals(CREATE)) {
                 for (String attrName : 
entityType.getRelationshipAttributes().keySet()) {
-                    Object         attrValue    = 
entity.getRelationshipAttribute(attrName);
-                    String         relationType = 
AtlasEntityUtil.getRelationshipType(attrValue);
-                    AtlasAttribute attribute    = 
entityType.getRelationshipAttribute(attrName, relationType);
-
-                    mapAttribute(attribute, attrValue, vertex, op, context);
+                    Object attrValue = 
entity.getRelationshipAttribute(attrName);
+                    if (attrValue != null) {

Review Comment:
   CREATE: We iterate every relationship-attribute name declared on the type. 
Anything not set on the entity is null. If you removed the` if (attrValue != 
null) `here, you would call `mapRelationshipAttributeWithMultipleTypes` for 
every missing attribute and treat “not in payload” like “clear,” which is 
wrong. So the CREATE null check stays. Comment added for developer's 
understanding
   



-- 
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