Repository: atlas
Updated Branches:
  refs/heads/master 2c84d7029 -> ce8f65c9c


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

Signed-off-by: Madhan Neethiraj <mad...@apache.org>


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

Branch: refs/heads/master
Commit: ce8f65c9c5f7f2cff3934829258ce3d2ebe84b60
Parents: 2c84d70
Author: apoorvnaik <apoorvn...@apache.org>
Authored: Fri Aug 18 16:23:09 2017 -0700
Committer: Madhan Neethiraj <mad...@apache.org>
Committed: Fri Aug 18 17:18:58 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/ce8f65c9/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;
             }

Reply via email to