You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by si...@apache.org on 2021/08/09 20:34:45 UTC

[atlas] branch branch-2.0 updated (3da4587 -> 024106f)

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

sidmishra pushed a change to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git.


    from 3da4587  updated committer information for Madhan Neethiraj
     new 6162943  Added committer information for Sidharth Mishra
     new ef0a450  ATLAS-4386 : Relationship search: Sorting does not work when passed relationship label
     new 024106f  ATLAS-4387:UI: Propagated Classifications shows wrong count for entity type on Entity detail page, fixed

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../js/views/detail_page/DetailPageLayoutView.js   |  2 +-
 .../js/views/detail_page/DetailPageLayoutView.js   |  2 +-
 pom.xml                                            | 11 +++++
 .../atlas/discovery/EntityDiscoveryService.java    | 13 ++++--
 .../apache/atlas/repository/graph/GraphHelper.java | 21 +++++++++
 .../atlas/discovery/AtlasDiscoveryServiceTest.java | 51 ++++++++++++++++++++++
 6 files changed, 95 insertions(+), 5 deletions(-)

[atlas] 01/03: Added committer information for Sidharth Mishra

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6162943283fe412ad11ffa10cab545335902ee29
Author: sidmishra <si...@cloudera.com>
AuthorDate: Wed Apr 28 12:09:42 2021 -0700

    Added committer information for Sidharth Mishra
    
    (cherry picked from commit 127ed22e7b50b7384f62abad47d8d1a175e395d3)
---
 pom.xml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pom.xml b/pom.xml
index 779dd8e..db429d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -485,6 +485,17 @@
             <!--<organizationUrl>https://www.cloudera.com</organizationUrl>-->
         </developer>
         <developer>
+            <id>sidmishra</id>
+            <name>Sidharth Mishra</name>
+            <email>sidmishra@apache.org</email>
+            <timezone>America/Los_Angeles</timezone>
+            <roles>
+                <role>committer</role>
+            </roles>
+            <organization>Cloudera Inc.</organization>
+            <!--<organizationUrl>https://www.cloudera.com</organizationUrl>-->
+        </developer>
+        <developer>
             <id>sriksun</id>
             <name>Srikanth Sundarrajan</name>
             <email>sriksun@apache.org</email>

[atlas] 03/03: ATLAS-4387:UI: Propagated Classifications shows wrong count for entity type on Entity detail page, fixed

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 024106faada51a21756204c735be9f93cdddbde2
Author: prasad pawar <pr...@freestoneinfotech.com>
AuthorDate: Thu Aug 5 18:36:08 2021 +0530

    ATLAS-4387:UI: Propagated Classifications shows wrong count for entity type on Entity detail page, fixed
    
    Signed-off-by: nixonrodrigues <ni...@apache.org>
    (cherry picked from commit 7917e548a9bf184fba9ed7b227bc153a7f11e949)
---
 dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js | 2 +-
 dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
index d8e10cc..bb629b4 100644
--- a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
+++ b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
@@ -255,7 +255,7 @@ define(['require',
                                 } else {
                                     tags['propagated'].push(val);
                                     if (tags.propagatedMap[typeName]) {
-                                        tags.propagatedMap[typeName]["count"] += tags.propagatedMap[typeName]["count"];
+                                        tags.propagatedMap[typeName]["count"]++;
                                     } else {
                                         tags.propagatedMap[typeName] = val;
                                         tags.propagatedMap[typeName]["count"] = 1;
diff --git a/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js
index 8e0686b..471be3b 100644
--- a/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js
+++ b/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js
@@ -259,7 +259,7 @@ define(['require',
                                 } else {
                                     tags['propagated'].push(val);
                                     if (tags.propagatedMap[typeName]) {
-                                        tags.propagatedMap[typeName]["count"] += tags.propagatedMap[typeName]["count"];
+                                        tags.propagatedMap[typeName]["count"]++;
                                     } else {
                                         tags.propagatedMap[typeName] = val;
                                         tags.propagatedMap[typeName]["count"] = 1;

[atlas] 02/03: ATLAS-4386 : Relationship search: Sorting does not work when passed relationship label

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ef0a450ae1f13e984bc974cf82d0096275acdc2d
Author: Pinal <pinal-shah>
AuthorDate: Wed Aug 4 20:21:34 2021 +0530

    ATLAS-4386 : Relationship search: Sorting does not work when passed relationship label
    
    Signed-off-by: Pinal <pinal-shah>
    (cherry picked from commit e3cbaabfba4f0aeb606c696492747759a8d34423)
---
 .../atlas/discovery/EntityDiscoveryService.java    | 13 ++++--
 .../apache/atlas/repository/graph/GraphHelper.java | 21 +++++++++
 .../atlas/discovery/AtlasDiscoveryServiceTest.java | 51 ++++++++++++++++++++++
 3 files changed, 82 insertions(+), 3 deletions(-)

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 f2290c6..5b3b948 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
@@ -585,13 +585,20 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
         }
 
         if (attribute != null) {
+            //get end entity type through relationship attribute
             endEntityType = attribute.getReferencedEntityType(typeRegistry);
 
-            if (endEntityType != null) {
-                relation = attribute.getRelationshipEdgeLabel();
-            } else {
+            if (endEntityType == null) {
                 throw new AtlasBaseException(AtlasErrorCode.INVALID_RELATIONSHIP_ATTRIBUTE, relation, attribute.getTypeName());
             }
+            relation = attribute.getRelationshipEdgeLabel();
+        } else {
+            //get end entity type through label
+            String endEntityTypeName = GraphHelper.getReferencedEntityTypeName(entityVertex, relation);
+
+            if (StringUtils.isNotEmpty(endEntityTypeName)) {
+                endEntityType = typeRegistry.getEntityTypeByName(endEntityTypeName);
+            }
         }
 
         //validate sortBy attribute
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
index ff7fd15..d5112bb 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
@@ -1605,6 +1605,27 @@ public final class GraphHelper {
         return ret;
     }
 
+    //get entity type of relationship (End vertex entity type) from relationship label
+    public static String getReferencedEntityTypeName(AtlasVertex entityVertex, String relation) {
+        String ret = null;
+        Iterator<AtlasEdge> edges    = GraphHelper.getAdjacentEdgesByLabel(entityVertex, AtlasEdgeDirection.BOTH, relation);
+
+        if (edges != null && edges.hasNext()) {
+            AtlasEdge   relationEdge = edges.next();
+            AtlasVertex outVertex    = relationEdge.getOutVertex();
+            AtlasVertex inVertex     = relationEdge.getInVertex();
+
+            if (outVertex != null && inVertex != null) {
+                String outVertexId    = outVertex.getIdForDisplay();
+                String entityVertexId = entityVertex.getIdForDisplay();
+                AtlasVertex endVertex = StringUtils.equals(outVertexId, entityVertexId) ? inVertex : outVertex;
+                ret                   = GraphHelper.getTypeName(endVertex);
+            }
+        }
+
+       return ret;
+    }
+
     public static boolean isRelationshipEdge(AtlasEdge edge) {
         if (edge == null) {
             return false;
diff --git a/repository/src/test/java/org/apache/atlas/discovery/AtlasDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/AtlasDiscoveryServiceTest.java
index a9fbd43..5e47295 100644
--- a/repository/src/test/java/org/apache/atlas/discovery/AtlasDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/AtlasDiscoveryServiceTest.java
@@ -20,6 +20,7 @@ package org.apache.atlas.discovery;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.BasicTestSetup;
+import org.apache.atlas.SortOrder;
 import org.apache.atlas.TestModules;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.discovery.AtlasQuickSearchResult;
@@ -54,6 +55,8 @@ public class AtlasDiscoveryServiceTest extends BasicTestSetup {
     @Inject
     private AtlasDiscoveryService discoveryService;
 
+    String salesFactGuid = null;
+
     @BeforeClass
     public void setup() throws Exception {
         super.initialize();
@@ -855,6 +858,54 @@ public class AtlasDiscoveryServiceTest extends BasicTestSetup {
         }
     }
 
+    @Test
+    public void searchRelatedEntitiesSortAsc() throws AtlasBaseException {
+        String guid = gethiveTableSalesFactGuid();
+
+        SearchParameters params = new SearchParameters();
+        params.setLimit(10);
+        AtlasSearchResult relResult  = discoveryService.searchRelatedEntities(guid, "__hive_table.columns", false, params);
+        List<AtlasEntityHeader> list = relResult.getEntities();
+
+        Assert.assertTrue(CollectionUtils.isNotEmpty(list));
+        Assert.assertTrue(list.size() == 4);
+        Assert.assertTrue(list.get(0).getDisplayText().equalsIgnoreCase("customer_id"));
+        Assert.assertTrue(list.get(3).getDisplayText().equalsIgnoreCase("time_id"));
+
+    }
+
+    @Test
+    public void searchRelatedEntitiesSortDesc() throws AtlasBaseException {
+        String guid = gethiveTableSalesFactGuid();
+
+        SearchParameters params = new SearchParameters();
+        params.setLimit(10);
+        params.setSortOrder(SortOrder.DESCENDING);
+
+        AtlasSearchResult relResult  = discoveryService.searchRelatedEntities(guid, "columns", false, params);
+        List<AtlasEntityHeader> list = relResult.getEntities();
+
+        Assert.assertTrue(CollectionUtils.isNotEmpty(list));
+        Assert.assertTrue(list.size() == 4);
+        Assert.assertTrue(list.get(3).getDisplayText().equalsIgnoreCase("customer_id"));
+        Assert.assertTrue(list.get(0).getDisplayText().equalsIgnoreCase("time_id"));
+    }
+
+    private String gethiveTableSalesFactGuid() throws AtlasBaseException {
+        if (salesFactGuid == null) {
+            SearchParameters params = new SearchParameters();
+            params.setTypeName(HIVE_TABLE_TYPE);
+            SearchParameters.FilterCriteria filterCriteria = getSingleFilterCondition("name",Operator.EQ, "sales_fact");
+            params.setEntityFilters(filterCriteria);
+            AtlasSearchResult result = discoveryService.searchWithParameters(params);
+
+            if (result != null && CollectionUtils.isNotEmpty(result.getEntities())) {
+                salesFactGuid = result.getEntities().get(0).getGuid();
+            }
+        }
+        return salesFactGuid;
+    }
+
     private void assertSearchResult(AtlasSearchResult searchResult, int expected, String query) {
         assertNotNull(searchResult);
         if(expected == 0) {