You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/06/20 16:31:16 UTC

[13/14] incubator-atlas git commit: ATLAS-1866: DSL 'like' operator fails for associated entity attributes

ATLAS-1866: DSL 'like' operator fails for associated entity attributes


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

Branch: refs/heads/feature-odf
Commit: c2d52759ff7ce70f0a17e6f7f2ac46f7e160b647
Parents: 906f365
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Sun Jun 18 17:27:55 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Sun Jun 18 17:30:51 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java | 4 +---
 .../java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java | 3 +--
 .../apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java  | 3 +++
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c2d52759/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
index 5f8bb80..27de0ed 100644
--- a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
+++ b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
@@ -40,7 +40,6 @@ import org.apache.atlas.groovy.LogicalExpression.LogicalOperator;
 import org.apache.atlas.groovy.RangeExpression;
 import org.apache.atlas.groovy.TernaryOperatorExpression;
 import org.apache.atlas.groovy.TraversalStepType;
-import org.apache.atlas.query.Expressions;
 import org.apache.atlas.query.GraphPersistenceStrategies;
 import org.apache.atlas.query.TypeUtils.FieldInfo;
 import org.apache.atlas.typesystem.types.IDataType;
@@ -154,9 +153,8 @@ public class Gremlin2ExpressionFactory extends GremlinExpressionFactory {
         GroovyExpression nameExpr    = new FieldExpression(itExpr, propertyName);
         GroovyExpression matchesExpr = new FunctionCallExpression(nameExpr, MATCHES, escapePropertyValue(propertyValue));
         GroovyExpression closureExpr = new ClosureExpression(matchesExpr);
-        GroovyExpression filterExpr  = new FunctionCallExpression(parent, FILTER_METHOD, closureExpr);
 
-        return filterExpr;
+        return new FunctionCallExpression(TraversalStepType.FILTER, parent, FILTER_METHOD, closureExpr);
     }
 
     private GroovyExpression escapePropertyValue(GroovyExpression propertyValue) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c2d52759/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
index aaec6fe..750cd84 100644
--- a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
+++ b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
@@ -250,9 +250,8 @@ public class Gremlin3ExpressionFactory extends GremlinExpressionFactory {
         GroovyExpression nameExpr    = new FieldExpression(itExpr, propertyName);
         GroovyExpression matchesExpr = new FunctionCallExpression(nameExpr, MATCHES, escapePropertyValue(propertyValue));
         GroovyExpression closureExpr = new ClosureExpression(matchesExpr);
-        GroovyExpression filterExpr  = new FunctionCallExpression(parent, FILTER_METHOD, closureExpr);
 
-        return filterExpr;
+        return new FunctionCallExpression(TraversalStepType.FILTER, parent, FILTER_METHOD, closureExpr);
     }
 
     private GroovyExpression escapePropertyValue(GroovyExpression propertyValue) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c2d52759/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
index 675ab8a..236134d 100755
--- a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
@@ -290,6 +290,9 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
                 {"hive_db where hive_db.name like \"R???rt?*\" or hive_db.name like \"S?l?s\" or hive_db.name like\"Log*\"", 3},
                 {"hive_db where hive_db.name like \"R???rt?*\" and hive_db.name like \"S?l?s\" and hive_db.name like\"Log*\"", 0},
                 {"hive_table where name like 'sales*', db where name like 'Sa?es'", 1},
+                {"hive_table where name like 'sales*' and db.name like 'Sa?es'", 1},
+                {"hive_table where db.name like \"Sa*\"", 4},
+                {"hive_table where db.name like \"Sa*\" and name like \"*dim\"", 3},
         };
     }