You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by am...@apache.org on 2019/12/02 21:39:25 UTC

[atlas] branch master updated: ATLAS-3532: DSL Composer update to address '_' test case. Part #2

This is an automated email from the ASF dual-hosted git repository.

amestry pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/master by this push:
     new 5955fcd  ATLAS-3532: DSL Composer update to address '_' test case. Part #2
5955fcd is described below

commit 5955fcd1390910b714b13716b8c2ffc8fc5932d8
Author: Nikhil Bonte <ni...@freestoneinfotech.com>
AuthorDate: Mon Dec 2 13:35:25 2019 -0800

    ATLAS-3532: DSL Composer update to address '_' test case. Part #2
    
    Signed-off-by: Ashutosh Mestry <am...@hortonworks.com>
---
 .../src/main/java/org/apache/atlas/query/GremlinQueryComposer.java     | 2 +-
 repository/src/main/java/org/apache/atlas/query/IdentifierHelper.java  | 3 +++
 .../src/test/java/org/apache/atlas/query/GremlinQueryComposerTest.java | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/repository/src/main/java/org/apache/atlas/query/GremlinQueryComposer.java b/repository/src/main/java/org/apache/atlas/query/GremlinQueryComposer.java
index a58aff1..8256d25 100644
--- a/repository/src/main/java/org/apache/atlas/query/GremlinQueryComposer.java
+++ b/repository/src/main/java/org/apache/atlas/query/GremlinQueryComposer.java
@@ -220,7 +220,7 @@ public class GremlinQueryComposer {
     }
 
     private boolean containsNumberAndLettersOnly(String rhs) {
-        return Pattern.matches(REGEX_ALPHA_NUMERIC_PATTERN, rhs);
+        return Pattern.matches(REGEX_ALPHA_NUMERIC_PATTERN, IdentifierHelper.removeWildcards(rhs));
     }
 
     private String parseNumber(String rhs, Context context) {
diff --git a/repository/src/main/java/org/apache/atlas/query/IdentifierHelper.java b/repository/src/main/java/org/apache/atlas/query/IdentifierHelper.java
index 0fdb57b..801ec02 100644
--- a/repository/src/main/java/org/apache/atlas/query/IdentifierHelper.java
+++ b/repository/src/main/java/org/apache/atlas/query/IdentifierHelper.java
@@ -113,6 +113,9 @@ public class IdentifierHelper {
         return s.replace("*", ".*").replace('?', '.');
     }
 
+    public static String removeWildcards(String s) {
+        return removeQuotes(s).replace("*", "").replace("?", "");
+    }
 
     public static class Info {
         private String   raw;
diff --git a/repository/src/test/java/org/apache/atlas/query/GremlinQueryComposerTest.java b/repository/src/test/java/org/apache/atlas/query/GremlinQueryComposerTest.java
index a3d511f..6f4df88 100644
--- a/repository/src/test/java/org/apache/atlas/query/GremlinQueryComposerTest.java
+++ b/repository/src/test/java/org/apache/atlas/query/GremlinQueryComposerTest.java
@@ -168,7 +168,7 @@ public class GremlinQueryComposerTest {
         verify("Table where Asset.name like \"Tab*\"",
                 "g.V().has('__typeName', 'Table').has('Asset.__s_name', org.janusgraph.core.attribute.Text.textRegex(\"Tab.*\")).dedup().limit(25).toList()");
         verify("Table where owner like \"Tab*\"",
-          "g.V().has('__typeName', 'Table').has('Table.owner', org.janusgraph.core.attribute.Text.textRegex(\"Tab.*\")).dedup().limit(25).toList()");
+          "g.V().has('__typeName', 'Table').has('Table.owner', org.janusgraph.core.attribute.Text.textContainsRegex(\"Tab.*\")).dedup().limit(25).toList()");
         verify("Table where owner like \"*Tab_*\"",
                 "g.V().has('__typeName', 'Table').has('Table.owner', org.janusgraph.core.attribute.Text.textRegex(\".*Tab_.*\")).dedup().limit(25).toList()");
         verify("from Table where (db.name = \"Reporting\")",