atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject incubator-atlas git commit: ATLAS-1815: Basic search API might return fewer entities when excludeDeletedEntities=true
Date Thu, 18 May 2017 22:08:14 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master bbf93327b -> 0cccec93f


ATLAS-1815: Basic search API might return fewer entities when excludeDeletedEntities=true


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/0cccec93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/0cccec93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/0cccec93

Branch: refs/heads/master
Commit: 0cccec93f60bd8dd530b924dced3d8de5dcccf3a
Parents: bbf9332
Author: Sarath Subramanian <ssubramanian@hortonworks.com>
Authored: Thu May 18 15:07:30 2017 -0700
Committer: Sarath Subramanian <ssubramanian@hortonworks.com>
Committed: Thu May 18 15:07:30 2017 -0700

----------------------------------------------------------------------
 .../org/apache/atlas/discovery/EntityDiscoveryService.java  | 9 ++++++---
 .../org/apache/atlas/util/AtlasGremlin2QueryProvider.java   | 2 ++
 .../org/apache/atlas/util/AtlasGremlinQueryProvider.java    | 1 +
 3 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/0cccec93/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
----------------------------------------------------------------------
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 874487c..e6a06c3 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
@@ -324,6 +324,12 @@ public class EntityDiscoveryService implements AtlasDiscoveryService
{
                 basicQuery += gremlinQueryProvider.getQuery(AtlasGremlinQuery.BASIC_SEARCH_TYPE_FILTER);
             }
 
+            if (excludeDeletedEntities) {
+                bindings.put("state", Status.ACTIVE.toString());
+
+                basicQuery += gremlinQueryProvider.getQuery(AtlasGremlinQuery.BASIC_SEARCH_STATE_FILTER);
+            }
+
             if (isGuidPrefixSearch) {
                 bindings.put("guid", attrValuePrefix + ".*");
 
@@ -347,9 +353,6 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
                     if (firstElement instanceof AtlasVertex) {
                         for (Object element : queryResult) {
                             if (element instanceof AtlasVertex) {
-                                if (skipDeletedEntities(excludeDeletedEntities, (AtlasVertex)
element)) {
-                                    continue;
-                                }
 
                                 ret.addEntity(entityRetriever.toAtlasEntityHeader((AtlasVertex)
element));
                             } else {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/0cccec93/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java
b/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java
index 139e7c3..1bf0346 100644
--- a/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java
+++ b/repository/src/main/java/org/apache/atlas/util/AtlasGremlin2QueryProvider.java
@@ -69,6 +69,8 @@ public class AtlasGremlin2QueryProvider extends AtlasGremlinQueryProvider
{
                 return ".has('__typeName', T.in, typeNames)";
             case BASIC_SEARCH_CLASSIFICATION_FILTER:
                 return ".has('__traitNames', T.in, traitNames)";
+            case BASIC_SEARCH_STATE_FILTER:
+                return ".has('__state', state)";
             case TO_RANGE_LIST:
                 return " [startIdx..<endIdx].toList()";
             case GUID_PREFIX_FILTER:

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/0cccec93/repository/src/main/java/org/apache/atlas/util/AtlasGremlinQueryProvider.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/util/AtlasGremlinQueryProvider.java
b/repository/src/main/java/org/apache/atlas/util/AtlasGremlinQueryProvider.java
index 8fb1793..8481a4f 100644
--- a/repository/src/main/java/org/apache/atlas/util/AtlasGremlinQueryProvider.java
+++ b/repository/src/main/java/org/apache/atlas/util/AtlasGremlinQueryProvider.java
@@ -58,6 +58,7 @@ public abstract class AtlasGremlinQueryProvider {
         // Discovery Queries
         BASIC_SEARCH_TYPE_FILTER,
         BASIC_SEARCH_CLASSIFICATION_FILTER,
+        BASIC_SEARCH_STATE_FILTER,
         TO_RANGE_LIST,
         GUID_PREFIX_FILTER
     }


Mime
View raw message