Commit ba4df832 by Ashutosh Mestry Committed by apoorvnaik

ATLAS-2430: Addressed close for nested queries.

parent 134d60fb
......@@ -47,12 +47,12 @@ public class IdentifierHelper {
return ret;
}
public static IdentifierMetadata create(GremlinQueryComposer.Context context,
org.apache.atlas.query.Lookup lookup,
String identifier) {
IdentifierMetadata ia = new IdentifierMetadata(identifier);
ia.update(lookup, context);
return ia;
public static Info create(GremlinQueryComposer.Context context,
org.apache.atlas.query.Lookup lookup,
String identifier) {
Info idInfo = new Info(identifier);
idInfo.update(lookup, context);
return idInfo;
}
private static String extract(Pattern p, String s) {
......@@ -106,7 +106,7 @@ public class IdentifierHelper {
}
public static class IdentifierMetadata {
public static class Info {
private String raw;
private String actual;
private String[] parts;
......@@ -123,7 +123,7 @@ public class IdentifierHelper {
private String qualifiedName;
private boolean isDate;
public IdentifierMetadata(String s) {
public Info(String s) {
this.raw = removeQuotes(s);
this.actual = IdentifierHelper.get(raw);
}
......
......@@ -214,6 +214,7 @@ public class DSLQueriesTest extends BasicTestSetup {
{"hive_db as db1 hive_table where (db1.name = \"Reporting\")", 0},
{"hive_table where (name = \"sales_fact\" and createTime > \"2014-01-01\" ) select name as _col_0, createTime as _col_1", 1},
{"hive_table where (name = \"sales_fact\" and createTime >= \"2014-12-11T02:35:58.440Z\" ) select name as _col_0, createTime as _col_1", 1},
{"hive_table where (name = \"sales_fact\" and db.name = \"Sales\") select name, createTime", 1},
{"Dimension", 5},
{"JdbcAccess", 2},
{"ETL", 5},
......
......@@ -314,6 +314,14 @@ public class GremlinQueryComposerTest {
}
@Test
public void whereComplexAndSelect() {
String exSel = "def f(r){ t=[['name']]; r.each({t.add([it.value('Table.name')])}); t.unique(); }";
String exMain = "g.V().has('__typeName', 'Table').and(__.out('__Table.db').has('DB.name', eq(\"Reporting\")).dedup().in('__Table.db'),__.has('Table.name', eq(\"sales_fact\"))).limit(local, 25).limit(25).toList()";
verify("Table where db.name = \"Reporting\" and name =\"sales_fact\" select name", getExpected(exSel, exMain));
verify("Table where db.name = \"Reporting\" and name =\"sales_fact\"", exMain);
}
@Test
public void invalidQueries() {
verify("hdfs_path like h1", "");
}
......
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