You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by Mandar Ambawane <ma...@freestoneinfotech.com> on 2021/06/21 12:40:42 UTC

Review Request 73428: ATLAS-3411 Relationships : Having multiple relationships on the same attribute

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73428/
-----------------------------------------------------------

Review request for atlas, Ashutosh Mestry, Jayendra Parab, Nixon Rodrigues, and Sarath Subramanian.


Bugs: ATLAS-3411
    https://issues.apache.org/jira/browse/ATLAS-3411


Repository: atlas


Description
-------

1. Created 2 association relationships between 2 types using the same attribute "rel_attribute".
2. Created entities with the first relationship . Relationship is created successfully.
3. In the entitydef of entity1 , "rel_attribute" is not found in both relatedAttributes / attributes. But in entitydef of entity2 "rel_attribute" is found which contains entity1 information.

This happens only when multiple relations are created on the same attribute.

Reason:

In the existing code,
If an EntityType has multiple Relationships for the same attribute, we only iterate over Incoming edges of the entity vertex to get the RelationshipType Name.

This RelationshipTypeName is used to get RelationshipAttribute. 

By using this RelationshipAttribute, RelationshipEdge (AtlasEdge) is fetched.

As this entity type does not have any Incoming edges, The RelationshipEdge (AtlasEdge) cannot be found. Hence the Relationship attribute for the current EntityType is set to NULL.

Solution:

In this patch,
If an EntityType has multiple Relationships for the same attribute and there are No Incoming edges present for the Entity vertex,
Then this patch iterates over the Outgoing edges of the Entity vertex to get the RelationshipType Name.

This RelationshipTypeName is used to get RelationshipAttribute. 
By using this RelationshipAttribute, RelationshipEdge (AtlasEdge) is fetched.


Diffs
-----

  repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java ff7fd15 


Diff: https://reviews.apache.org/r/73428/diff/1/


Testing
-------

PreCommit: https://ci-builds.apache.org/job/Atlas/job/PreCommit-ATLAS-Build-Test/678/consoleFull


Thanks,

Mandar Ambawane