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-2061: fixed basic-search handling of enum attributes in filter
Date Sat, 19 Aug 2017 00:19:43 GMT
Repository: atlas
Updated Branches:
  refs/heads/0.8-incubating caf89a309 -> acdcb7df9


ATLAS-2061: fixed basic-search handling of enum attributes in filter

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


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

Branch: refs/heads/0.8-incubating
Commit: acdcb7df904d9192832902a04b2f8d1329c50e83
Parents: caf89a3
Author: apoorvnaik <apoorvnaik@apache.org>
Authored: Fri Aug 18 16:23:09 2017 -0700
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Fri Aug 18 17:19:24 2017 -0700

----------------------------------------------------------------------
 .../org/apache/atlas/discovery/SearchProcessor.java  | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/acdcb7df/repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java b/repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
index 15564fc..d5e3923 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
@@ -29,8 +29,10 @@ import org.apache.atlas.repository.graphdb.AtlasIndexQuery;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1;
 import org.apache.atlas.type.AtlasEntityType;
+import org.apache.atlas.type.AtlasEnumType;
 import org.apache.atlas.type.AtlasStructType;
 import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
+import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.util.AtlasGremlinQueryProvider;
 import org.apache.atlas.util.SearchPredicateUtil.VertexAttributePredicateGenerator;
 import org.apache.commons.collections.CollectionUtils;
@@ -409,9 +411,10 @@ public abstract class SearchProcessor {
         VertexAttributePredicateGenerator predicate = OPERATOR_PREDICATE_MAP.get(op);
 
         if (attribute != null && predicate != null) {
-            final String attributeType = attribute.getAttributeType().getTypeName().toLowerCase();
-            final Class  attrClass;
-            final Object attrValue;
+            final AtlasType attrType      = attribute.getAttributeType();
+            final String    attributeType = attrType.getTypeName().toLowerCase();
+            final Class     attrClass;
+            final Object    attrValue;
 
             switch (attributeType) {
                 case "string":
@@ -456,7 +459,11 @@ public abstract class SearchProcessor {
                     attrValue = new BigDecimal(attrVal);
                     break;
                 default:
-                    attrClass = Object.class;
+                    if (attrType instanceof AtlasEnumType) {
+                        attrClass = String.class;
+                    } else {
+                        attrClass = Object.class;
+                    }
                     attrValue = attrVal;
                     break;
             }


Mime
View raw message