pinal-shah commented on code in PR #478:
URL: https://github.com/apache/atlas/pull/478#discussion_r3071908534
##########
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) {
+ mapRelationshipAttributeWithMultipleTypes(entity,
entityType, attrName, attrValue, vertex, op, context);
+ }
}
} else if (op.equals(UPDATE) || op.equals(PARTIAL_UPDATE)) {
// relationship attributes mapping
for (String attrName :
entityType.getRelationshipAttributes().keySet()) {
if (entity.hasRelationshipAttribute(attrName)) {
- 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:
please review if this check is required
--
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]