This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 2caf30ae21556bd0ae3ea0b791344f50defe460d
Author: Madhan Neethiraj <mad...@apache.org>
AuthorDate: Sun Apr 14 23:42:08 2019 -0700

    ATLAS-3139: updated basic search to include relationship attributes as well 
in the result
    
    (cherry picked from commit 9c9eed274532391ceb57a0e17d0b2f8611530f8a)
---
 intg/src/main/java/org/apache/atlas/type/AtlasStructType.java     | 6 +++---
 .../java/org/apache/atlas/discovery/EntityDiscoveryService.java   | 8 ++++++++
 .../atlas/repository/store/graph/v2/EntityGraphRetriever.java     | 8 +++++++-
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 
b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
index 31953bd..254eee4 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
@@ -744,19 +744,19 @@ public class AtlasStructType extends AtlasType {
             this.inverseRefAttributeName   = inverseRefAttribute;
             this.relationshipEdgeDirection = 
AtlasRelationshipEdgeDirection.OUT;
 
-            switch (attributeType.getTypeCategory()) {
+            switch (this.attributeType.getTypeCategory()) {
                 case OBJECT_ID_TYPE:
                     isObjectRef = true;
                 break;
 
                 case MAP:
-                    AtlasMapType mapType = (AtlasMapType) attributeType;
+                    AtlasMapType mapType = (AtlasMapType) this.attributeType;
 
                     isObjectRef = mapType.getValueType().getTypeCategory() == 
OBJECT_ID_TYPE;
                 break;
 
                 case ARRAY:
-                    AtlasArrayType arrayType = (AtlasArrayType) attributeType;
+                    AtlasArrayType arrayType = (AtlasArrayType) 
this.attributeType;
 
                     isObjectRef = arrayType.getElementType().getTypeCategory() 
== OBJECT_ID_TYPE;
                 break;
diff --git 
a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
 
b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
index 19f81d3..420e359 100644
--- 
a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
+++ 
b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
@@ -451,6 +451,10 @@ public class EntityDiscoveryService implements 
AtlasDiscoveryService {
                 for (String resultAttribute : resultAttributes) {
                     AtlasAttribute  attribute  = 
entityType.getAttribute(resultAttribute);
 
+                    if (attribute == null) {
+                        attribute = 
entityType.getRelationshipAttribute(resultAttribute, null);
+                    }
+
                     if (attribute != null) {
                         AtlasType attributeType = attribute.getAttributeType();
 
@@ -536,6 +540,10 @@ public class EntityDiscoveryService implements 
AtlasDiscoveryService {
 
         AtlasAttribute attribute = entityType.getAttribute(relation);
 
+        if (attribute == null) {
+            attribute = entityType.getRelationshipAttribute(relation, null);
+        }
+
         if (attribute != null) {
             if (attribute.isObjectRef()) {
                 relation = attribute.getRelationshipEdgeLabel();
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
index efcddef..3f3e95a 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
@@ -521,7 +521,13 @@ public class EntityGraphRetriever {
                         continue;
                     }
 
-                    Object attrValue = getVertexAttribute(entityVertex, 
entityType.getAttribute(nonQualifiedAttrName));
+                    AtlasAttribute attribute = 
entityType.getAttribute(nonQualifiedAttrName);
+
+                    if (attribute == null) {
+                        attribute = 
entityType.getRelationshipAttribute(nonQualifiedAttrName, null);
+                    }
+
+                    Object attrValue = getVertexAttribute(entityVertex, 
attribute);
 
                     if (attrValue != null) {
                         ret.setAttribute(nonQualifiedAttrName, attrValue);

Reply via email to