Commit 67acb9d6 by Shwetha GS

ATLAS-639 Exception for lineage request (svimal2106 via shwethags)

parent f672aaef
...@@ -1620,7 +1620,7 @@ public class HiveHookIT { ...@@ -1620,7 +1620,7 @@ public class HiveHookIT {
expectedProps.put("testPropKey2", "testPropValue2"); expectedProps.put("testPropKey2", "testPropValue2");
//Add another property //Add another property
query = String.format(fmtQuery, entityName, SET_OP, getSerializedProps(expectedProps)); query = String.format(fmtQuery, entityName, SET_OP, getSerializedProps(expectedProps));
runCommand(query); runCommandWithDelay(query, 1000);
verifyEntityProperties(entityType, entityName, expectedProps, false); verifyEntityProperties(entityType, entityName, expectedProps, false);
if (entityType != Entity.Type.DATABASE) { if (entityType != Entity.Type.DATABASE) {
...@@ -1628,7 +1628,7 @@ public class HiveHookIT { ...@@ -1628,7 +1628,7 @@ public class HiveHookIT {
//Unset all the props //Unset all the props
StringBuilder sb = new StringBuilder("'"); StringBuilder sb = new StringBuilder("'");
query = String.format(fmtQuery, entityName, UNSET_OP, Joiner.on("','").skipNulls().appendTo(sb, expectedProps.keySet()).append('\'')); query = String.format(fmtQuery, entityName, UNSET_OP, Joiner.on("','").skipNulls().appendTo(sb, expectedProps.keySet()).append('\''));
runCommand(query); runCommandWithDelay(query, 1000);
verifyEntityProperties(entityType, entityName, expectedProps, true); verifyEntityProperties(entityType, entityName, expectedProps, true);
} }
......
...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES: ...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
ALL CHANGES: ALL CHANGES:
ATLAS-639 Exception for lineage request (svimal2106 via shwethags)
ATLAS-1022 Update typesystem wiki with details (yhemanth via shwethags) ATLAS-1022 Update typesystem wiki with details (yhemanth via shwethags)
ATLAS-1021 Update Atlas architecture wiki (yhemanth via sumasai) ATLAS-1021 Update Atlas architecture wiki (yhemanth via sumasai)
ATLAS-957 Atlas is not capturing topologies that have $ in the data payload (shwethags) ATLAS-957 Atlas is not capturing topologies that have $ in the data payload (shwethags)
......
...@@ -280,9 +280,10 @@ class GremlinTranslator(expr: Expression, ...@@ -280,9 +280,10 @@ class GremlinTranslator(expr: Expression,
val inputQry = genQuery(input, inSelect) val inputQry = genQuery(input, inSelect)
val loopingPathGExpr = genQuery(loopExpr, inSelect) val loopingPathGExpr = genQuery(loopExpr, inSelect)
val loopGExpr = s"""loop("${input.asInstanceOf[AliasExpression].alias}")""" val loopGExpr = s"""loop("${input.asInstanceOf[AliasExpression].alias}")"""
val untilCriteria = if (t.isDefined) s"{it.loops < ${t.get.value}}" else "{true}" val untilCriteria = if (t.isDefined) s"{it.loops < ${t.get.value}}" else "{it.path.contains(it.object)?false:true}"
val loopObjectGExpr = gPersistenceBehavior.loopObjectExpression(input.dataType) val loopObjectGExpr = gPersistenceBehavior.loopObjectExpression(input.dataType)
s"""${inputQry}.${loopingPathGExpr}.${loopGExpr}${untilCriteria}${loopObjectGExpr}""" val enablePathExpr = s".enablePath()"
s"""${inputQry}.${loopingPathGExpr}.${loopGExpr}${untilCriteria}${loopObjectGExpr}${enablePathExpr}"""
} }
case BackReference(alias, _, _) => case BackReference(alias, _, _) =>
if (inSelect) gPersistenceBehavior.fieldPrefixInSelect else s"""back("$alias")""" if (inSelect) gPersistenceBehavior.fieldPrefixInSelect else s"""back("$alias")"""
......
...@@ -224,6 +224,16 @@ public class BaseRepositoryTest { ...@@ -224,6 +224,16 @@ public class BaseRepositoryTest {
table("sales_fact_daily_mv", "sales fact daily materialized view", reportingDB, sd, "Joe BI", "Managed", table("sales_fact_daily_mv", "sales fact daily materialized view", reportingDB, sd, "Joe BI", "Managed",
salesFactColumns, "Metric"); salesFactColumns, "Metric");
Id circularLineageTable1 = table("table1", "", reportingDB, sd, "Vimal", "Managed", salesFactColumns, "Metric");
Id circularLineageTable2 = table("table2", "", reportingDB, sd, "Vimal", "Managed", salesFactColumns, "Metric");
loadProcess("circularLineage1", "hive query for daily summary", "John ETL", ImmutableList.of(circularLineageTable1),
ImmutableList.of(circularLineageTable2), "create table as select ", "plan", "id", "graph", "ETL");
loadProcess("circularLineage2", "hive query for daily summary", "John ETL", ImmutableList.of(circularLineageTable2),
ImmutableList.of(circularLineageTable1), "create table as select ", "plan", "id", "graph", "ETL");
loadProcess("loadSalesDaily", "hive query for daily summary", "John ETL", ImmutableList.of(salesFact, timeDim), loadProcess("loadSalesDaily", "hive query for daily summary", "John ETL", ImmutableList.of(salesFact, timeDim),
ImmutableList.of(salesFactDaily), "create table as select ", "plan", "id", "graph", "ETL"); ImmutableList.of(salesFactDaily), "create table as select ", "plan", "id", "graph", "ETL");
......
...@@ -176,6 +176,22 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest { ...@@ -176,6 +176,22 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
} }
@Test @Test
public void testCircularLineage() throws Exception{
JSONObject results = new JSONObject(lineageService.getInputsGraph("table2"));
assertNotNull(results);
System.out.println("inputs graph = " + results);
JSONObject values = results.getJSONObject("values");
assertNotNull(values);
final JSONObject vertices = values.getJSONObject("vertices");
Assert.assertEquals(vertices.length(), 2);
final JSONObject edges = values.getJSONObject("edges");
Assert.assertEquals(edges.length(), 4);
}
@Test
public void testGetInputsGraphForEntity() throws Exception { public void testGetInputsGraphForEntity() throws Exception {
ITypedReferenceableInstance entity = ITypedReferenceableInstance entity =
repository.getEntityDefinition(HIVE_TABLE_TYPE, "name", "sales_fact_monthly_mv"); repository.getEntityDefinition(HIVE_TABLE_TYPE, "name", "sales_fact_monthly_mv");
......
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