forked from finos/legend-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial M2M Graphfetch support in lineage computation (finos#3058)
* Initial M2M lineage support
- Loading branch information
1 parent
53b11e2
commit c8d2e88
Showing
4 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...-analytics-lineage-pure/src/main/resources/core_analytics_lineage/tests/m2mAnalytics.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import meta::analytics::lineage::*; | ||
import meta::pure::extension::*; | ||
import meta::core::runtime::*; | ||
import meta::pure::graphFetch::execution::*; | ||
import meta::analytics::lineage::tests::*; | ||
|
||
function <<meta::pure::profiles::test.Test>> meta::analytics::lineage::tests::testSimpleM2M() : Boolean[1] | ||
{ | ||
let result = computeLineage({| TargetClass.all()->graphFetch(#{TargetClass{value1}}#)->serialize(#{TargetClass{value1}}#)}, | ||
mappingForTestPropertyLineage, | ||
^Runtime(connectionStores = ^meta::core::runtime::ConnectionStore( | ||
connection=^meta::external::store::model::ModelConnection(instances = newMap(pair(TargetClass, list([])))), | ||
element=^meta::external::store::model::ModelStore())), | ||
defaultExtensions() | ||
); | ||
|
||
let expectedDatabaseNodesId = []; | ||
let expectedDatabaseEdgesId = []; | ||
|
||
let expectedClassNodesId = [ | ||
'Lambda', | ||
'meta::analytics::lineage::tests::TargetClass', | ||
'meta::analytics::lineage::tests::SourceClass', | ||
'pack_meta::analytics::lineage::tests' | ||
]; | ||
|
||
let expectedClassEdgesId = [ | ||
'Lambda -> meta::analytics::lineage::tests::TargetClass', | ||
'meta::analytics::lineage::tests::TargetClass -> pack_meta::analytics::lineage::tests', | ||
'meta::analytics::lineage::tests::TargetClass -> meta::analytics::lineage::tests::SourceClass', | ||
'meta::analytics::lineage::tests::SourceClass -> pack_meta::analytics::lineage::tests' | ||
]; | ||
|
||
let expectedPropertyTrees = [ | ||
['root\n', | ||
' c_TargetClass\n', | ||
' p_TargetClass.value1\n']->joinStrings() | ||
]; | ||
|
||
assertSameElements($expectedDatabaseNodesId, $result.databaseLineage.nodes); | ||
assertSameElements($expectedDatabaseEdgesId, $result.databaseLineage.edges); | ||
assertSameElements($expectedClassNodesId, $result.classLineage.nodes.data.id); | ||
assertSameElements($expectedClassEdgesId, $result.classLineage.edges.data->map(m | $m.target.data.id + ' -> ' + $m.source.data.id)); | ||
assertSameElements($expectedPropertyTrees, $result.functionTrees->map(ft | $ft->meta::pure::lineage::scanProperties::propertyTree::printTree(''))); | ||
} | ||
|
||
Class meta::analytics::lineage::tests::TargetClass | ||
{ | ||
value1 : String[1]; | ||
} | ||
|
||
Class meta::analytics::lineage::tests::SourceClass | ||
{ | ||
src1 : SourceClass1[1]; | ||
src2: String[1]; | ||
} | ||
|
||
Class meta::analytics::lineage::tests::SourceClass1 | ||
{ | ||
value : String[1]; | ||
} | ||
|
||
###Mapping | ||
import meta::analytics::lineage::tests::*; | ||
Mapping meta::analytics::lineage::tests::mappingForTestPropertyLineage | ||
( | ||
TargetClass : Pure | ||
{ | ||
~src SourceClass | ||
value1: $src.src1.value + '_' + $src.src2 | ||
} | ||
) |