atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject atlas git commit: ATLAS-2082: basic-search fails when in-memory filters all results from index-query
Date Wed, 23 Aug 2017 18:00:07 GMT
Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 0055507ca -> 45d05d110


ATLAS-2082: basic-search fails when in-memory filters all results from index-query

(cherry picked from commit 64c9bde668b52c6f621c19110f2da0a0907704d8)


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

Branch: refs/heads/branch-0.8
Commit: 45d05d11088db48ff33e857151e0bd6882f9388f
Parents: 0055507
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Wed Aug 23 09:57:46 2017 -0700
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Wed Aug 23 11:00:01 2017 -0700

----------------------------------------------------------------------
 .../ClassificationSearchProcessor.java          | 25 ++++++++++---------
 .../atlas/discovery/EntitySearchProcessor.java  | 26 ++++++++++++++------
 2 files changed, 31 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/45d05d11/repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
b/repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
index 29670bc..0daab03 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
@@ -236,22 +236,23 @@ public class ClassificationSearchProcessor extends SearchProcessor {
             // Now filter on the tag attributes
             Set<String> guids = getGuids(entityVertices);
 
-            gremlinQueryBindings.put("guids", guids);
+            // Clear prior results
+            entityVertices.clear();
 
-            try {
-                AtlasGraph        graph               = context.getGraph();
-                ScriptEngine      gremlinScriptEngine = graph.getGremlinScriptEngine();
-                List<AtlasVertex> atlasVertices       = (List<AtlasVertex>) graph.executeGremlinScript(gremlinScriptEngine,
gremlinQueryBindings, gremlinTagFilterQuery, false);
+            if (CollectionUtils.isNotEmpty(guids)) {
+                gremlinQueryBindings.put("guids", guids);
 
-                // Clear prior results
-                entityVertices.clear();
+                try {
+                    AtlasGraph        graph               = context.getGraph();
+                    ScriptEngine      gremlinScriptEngine = graph.getGremlinScriptEngine();
+                    List<AtlasVertex> atlasVertices       = (List<AtlasVertex>)
graph.executeGremlinScript(gremlinScriptEngine, gremlinQueryBindings, gremlinTagFilterQuery,
false);
 
-                if (CollectionUtils.isNotEmpty(atlasVertices)) {
-                    entityVertices.addAll(atlasVertices);
+                    if (CollectionUtils.isNotEmpty(atlasVertices)) {
+                        entityVertices.addAll(atlasVertices);
+                    }
+                } catch (AtlasBaseException | ScriptException e) {
+                    LOG.warn(e.getMessage(), e);
                 }
-
-            } catch (AtlasBaseException | ScriptException e) {
-                LOG.warn(e.getMessage(), e);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/45d05d11/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
b/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
index f4ac8ab..a4a638a 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
@@ -173,12 +173,17 @@ public class EntitySearchProcessor extends SearchProcessor {
                     CollectionUtils.filter(entityVertices, inMemoryPredicate);
 
                     if (graphQuery != null) {
-                        AtlasGraphQuery guidQuery = context.getGraph().query().in(Constants.GUID_PROPERTY_KEY,
getGuids(entityVertices));
-
-                        guidQuery.addConditionsFrom(graphQuery);
+                        Set<String> guids = getGuids(entityVertices);
 
                         entityVertices.clear();
-                        getVertices(guidQuery.vertices().iterator(), entityVertices);
+
+                        if (CollectionUtils.isNotEmpty(guids)) {
+                            AtlasGraphQuery guidQuery = context.getGraph().query().in(Constants.GUID_PROPERTY_KEY,
guids);
+
+                            guidQuery.addConditionsFrom(graphQuery);
+
+                            getVertices(guidQuery.vertices().iterator(), entityVertices);
+                        }
                     }
                 } else {
                     Iterator<AtlasVertex> queryResult = graphQuery.vertices(qryOffset,
limit).iterator();
@@ -211,12 +216,17 @@ public class EntitySearchProcessor extends SearchProcessor {
             LOG.debug("==> EntitySearchProcessor.filter({})", entityVertices.size());
         }
 
-        AtlasGraphQuery query = context.getGraph().query().in(Constants.GUID_PROPERTY_KEY,
getGuids(entityVertices));
-
-        query.addConditionsFrom(filterGraphQuery);
+        Set<String> guids = getGuids(entityVertices);
 
         entityVertices.clear();
-        getVertices(query.vertices().iterator(), entityVertices);
+
+        if (CollectionUtils.isNotEmpty(guids)) {
+            AtlasGraphQuery query = context.getGraph().query().in(Constants.GUID_PROPERTY_KEY,
guids);
+
+            query.addConditionsFrom(filterGraphQuery);
+
+            getVertices(query.vertices().iterator(), entityVertices);
+        }
 
         super.filter(entityVertices);
 


Mime
View raw message