Commit 5955fcd1 by Nikhil Bonte Committed by Ashutosh Mestry

ATLAS-3532: DSL Composer update to address '_' test case. Part #2

parent 48df6544
...@@ -220,7 +220,7 @@ public class GremlinQueryComposer { ...@@ -220,7 +220,7 @@ public class GremlinQueryComposer {
} }
private boolean containsNumberAndLettersOnly(String rhs) { 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) { private String parseNumber(String rhs, Context context) {
......
...@@ -113,6 +113,9 @@ public class IdentifierHelper { ...@@ -113,6 +113,9 @@ public class IdentifierHelper {
return s.replace("*", ".*").replace('?', '.'); return s.replace("*", ".*").replace('?', '.');
} }
public static String removeWildcards(String s) {
return removeQuotes(s).replace("*", "").replace("?", "");
}
public static class Info { public static class Info {
private String raw; private String raw;
......
...@@ -168,7 +168,7 @@ public class GremlinQueryComposerTest { ...@@ -168,7 +168,7 @@ public class GremlinQueryComposerTest {
verify("Table where Asset.name like \"Tab*\"", 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()"); "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*\"", 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_*\"", 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.textRegex(\".*Tab_.*\")).dedup().limit(25).toList()");
verify("from Table where (db.name = \"Reporting\")", verify("from Table where (db.name = \"Reporting\")",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment