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-2121: basic-search update to use case-sensitive filter for type-name / tag-name
Date Wed, 20 Sep 2017 04:28:50 GMT
Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 2dc137c18 -> 5645c9e71


ATLAS-2121: basic-search update to use case-sensitive filter for type-name / tag-name

Signed-off-by: Madhan Neethiraj <madhan@apache.org>
(cherry picked from commit c0f0abc13037a9d05499dbce2d0e1b65beb9d656)


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

Branch: refs/heads/branch-0.8
Commit: 5645c9e71fd032ccb187989834dd82edb8c13c4a
Parents: 2dc137c
Author: apoorvnaik <apoorvnaik@apache.org>
Authored: Tue Sep 19 11:57:01 2017 -0700
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Tue Sep 19 21:28:10 2017 -0700

----------------------------------------------------------------------
 .../discovery/ClassificationSearchProcessor.java   | 10 +++++++++-
 .../atlas/discovery/EntitySearchProcessor.java     | 17 +++++++++--------
 2 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/5645c9e7/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 1d4815d..776f5bf 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
@@ -34,6 +34,7 @@ import org.apache.atlas.util.SearchPredicateUtil;
 import org.apache.atlas.utils.AtlasPerfTracer;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.PredicateUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -93,7 +94,14 @@ public class ClassificationSearchProcessor extends SearchProcessor {
 
             this.indexQuery = graph.indexQuery(Constants.VERTEX_INDEX, indexQueryString);
 
-            inMemoryPredicate = constructInMemoryPredicate(classificationType, filterCriteria,
indexAttributes);
+            Predicate typeNamePredicate  = SearchPredicateUtil.getINPredicateGenerator()
+                                                              .generatePredicate(Constants.TYPE_NAME_PROPERTY_KEY,
typeAndSubTypes, String.class);
+            Predicate attributePredicate = constructInMemoryPredicate(classificationType,
filterCriteria, indexAttributes);
+            if (attributePredicate != null) {
+                inMemoryPredicate = PredicateUtils.andPredicate(typeNamePredicate, attributePredicate);
+            } else {
+                inMemoryPredicate = typeNamePredicate;
+            }
         } else {
             indexQuery = null;
         }

http://git-wip-us.apache.org/repos/asf/atlas/blob/5645c9e7/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 970cd28..87efed7 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
@@ -80,12 +80,20 @@ public class EntitySearchProcessor extends SearchProcessor {
 
         if (typeSearchByIndex) {
             constructTypeTestQuery(indexQuery, typeAndSubTypesQryStr);
+
+            // TypeName check to be done in-memory as well to address ATLAS-2121 (case sensitivity)
+            inMemoryPredicate = typeNamePredicate;
         }
 
         if (attrSearchByIndex) {
             constructFilterQuery(indexQuery, entityType, filterCriteria, indexAttributes);
 
-            inMemoryPredicate = constructInMemoryPredicate(entityType, filterCriteria, indexAttributes);
+            Predicate attributePredicate = constructInMemoryPredicate(entityType, filterCriteria,
indexAttributes);
+            if (inMemoryPredicate != null) {
+                inMemoryPredicate = PredicateUtils.andPredicate(inMemoryPredicate, attributePredicate);
+            } else {
+                inMemoryPredicate = attributePredicate;
+            }
         } else {
             graphAttributes.addAll(indexAttributes);
         }
@@ -110,13 +118,6 @@ public class EntitySearchProcessor extends SearchProcessor {
 
             if (!typeSearchByIndex) {
                 query.in(Constants.TYPE_NAME_PROPERTY_KEY, typeAndSubTypes);
-
-                // Construct a parallel in-memory predicate
-                if (graphQueryPredicate != null) {
-                    graphQueryPredicate = PredicateUtils.andPredicate(graphQueryPredicate,
typeNamePredicate);
-                } else {
-                    graphQueryPredicate = typeNamePredicate;
-                }
             }
 
             // If we need to filter on the trait names then we need to build the query and
equivalent in-memory predicate


Mime
View raw message