From 99e29b0bec986c5cca78a2eddb8b91642a892ddb Mon Sep 17 00:00:00 2001 From: afine-gs Date: Tue, 5 Nov 2024 13:52:53 -0500 Subject: [PATCH] testWrapper --- .../pom.xml | 270 ++++++++++++++++++ ...LineageAnalysisCodeRepositoryProvider.java | 30 ++ ...lesystem.repository.CodeRepositoryProvider | 17 ++ ...re_executable_test_wrapper.definition.json | 14 + .../testWrapper.pure | 102 +++++++ .../legend-engine-core-testable/pom.xml | 1 + .../finos/legend/engine/ide/PureIDELight.java | 2 + .../core_analytics_lineage/fullAnalytics.pure | 86 ++++++ .../core_analytics_lineage/graph.pure | 67 ++--- .../pom.xml | 12 +- .../resources/core_relational.definition.json | 3 +- .../association/testAssociationEmbedded.pure | 5 +- 12 files changed, 573 insertions(+), 36 deletions(-) create mode 100644 legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/pom.xml create mode 100644 legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/java/org/finos/legend/pure/code/core/CoreExternalLineageAnalysisCodeRepositoryProvider.java create mode 100644 legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider create mode 100644 legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/core_executable_test_wrapper.definition.json create mode 100644 legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/core_executable_test_wrapper/testWrapper.pure diff --git a/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/pom.xml b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/pom.xml new file mode 100644 index 00000000000..ae726131cc9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/pom.xml @@ -0,0 +1,270 @@ + + + + + 4.0.0 + + org.finos.legend.engine + legend-engine-core-testable + 4.62.2-SNAPSHOT + + + legend-engine-executable-test-pure + + + 11 + 11 + UTF-8 + + + + + org.finos.legend.pure + legend-pure-maven-generation-par + + src/main/resources + ${legend.pure.version} + + platform + core + core_relational + core_analytics_lineage + + + ${project.basedir}/src/main/resources/core_analytics_lineage.definition.json + + + + + compile + + build-pure-jar + + + + + + org.finos.legend.pure + legend-pure-m2-dsl-mapping-grammar + ${legend.pure.version} + + + org.finos.legend.pure + legend-pure-m2-dsl-diagram-grammar + ${legend.pure.version} + + + org.finos.legend.pure + legend-pure-m2-dsl-graph-grammar + ${legend.pure.version} + + + org.finos.legend.pure + legend-pure-m2-dsl-path-grammar + ${legend.pure.version} + + + org.finos.legend.pure + legend-pure-m2-store-relational-grammar + ${legend.pure.version} + + + + org.finos.legend.engine + legend-engine-pure-code-compiled-core + ${project.version} + + + org.finos.legend.engine + legend-engine-xt-relationalStore-core-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + + + + org.finos.legend.pure + legend-pure-maven-generation-java + + + compile + + build-pure-compiled-jar + + + true + modular + true + + core_analytics_lineage + + + + + + + org.finos.legend.pure + legend-pure-m2-dsl-mapping-grammar + ${legend.pure.version} + + + org.finos.legend.pure + legend-pure-m2-dsl-diagram-grammar + ${legend.pure.version} + + + org.finos.legend.pure + legend-pure-m2-dsl-graph-grammar + ${legend.pure.version} + + + org.finos.legend.pure + legend-pure-m2-dsl-path-grammar + ${legend.pure.version} + + + org.finos.legend.pure + legend-pure-m2-dsl-path-grammar + ${legend.pure.version} + + + org.finos.legend.pure + legend-pure-m2-store-relational-grammar + ${legend.pure.version} + + + + org.finos.legend.engine + legend-engine-pure-code-compiled-core + ${project.version} + + + org.finos.legend.engine + legend-engine-xt-relationalStore-core-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + + + + + + + + + org.finos.legend.pure + legend-pure-m4 + + + org.finos.legend.pure + legend-pure-m3-core + + + org.finos.legend.pure + legend-pure-m2-dsl-path-pure + + + org.finos.legend.pure + legend-pure-m2-dsl-graph-pure + + + org.finos.legend.pure + legend-pure-m2-dsl-mapping-pure + + + org.finos.legend.pure + legend-pure-m2-store-relational-pure + + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + + org.finos.legend.pure + legend-pure-m2-dsl-graph-pure + ${legend.pure.version} + + + + + org.finos.legend.engine + legend-engine-pure-code-compiled-core + + + org.finos.legend.engine + legend-engine-pure-platform-java + + + org.finos.legend.engine + legend-engine-pure-platform-store-relational-java + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json + + + org.finos.legend.engine + legend-engine-pure-platform-dsl-mapping-java + + + org.finos.legend.engine + legend-engine-pure-platform-dsl-store-java + + + + org.finos.legend.engine + legend-engine-xt-relationalStore-core-pure + + + + + org.eclipse.collections + eclipse-collections + + + org.eclipse.collections + eclipse-collections-api + + + + + junit + junit + + + + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/java/org/finos/legend/pure/code/core/CoreExternalLineageAnalysisCodeRepositoryProvider.java b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/java/org/finos/legend/pure/code/core/CoreExternalLineageAnalysisCodeRepositoryProvider.java new file mode 100644 index 00000000000..c4a4550e82a --- /dev/null +++ b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/java/org/finos/legend/pure/code/core/CoreExternalLineageAnalysisCodeRepositoryProvider.java @@ -0,0 +1,30 @@ +/* + * Copyright 2022 Goldman Sachs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.finos.legend.pure.code.core; + +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepository; +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider; +import org.finos.legend.pure.m3.serialization.filesystem.repository.GenericCodeRepository; + +public class CoreExternalLineageAnalysisCodeRepositoryProvider implements CodeRepositoryProvider +{ + @Override + public CodeRepository repository() + { + return GenericCodeRepository.build("core_executable_test_wrapper.definition.json"); + } +} diff --git a/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider new file mode 100644 index 00000000000..8ed7aa74ab8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider @@ -0,0 +1,17 @@ +# +# Copyright 2022 Goldman Sachs +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +org.finos.legend.pure.code.core.CoreExternalLineageAnalysisCodeRepositoryProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/core_executable_test_wrapper.definition.json b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/core_executable_test_wrapper.definition.json new file mode 100644 index 00000000000..c39a2353894 --- /dev/null +++ b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/core_executable_test_wrapper.definition.json @@ -0,0 +1,14 @@ +{ + "name": "core_executable_test_wrapper", + "pattern": "(meta::pure::test)(::.*)?", + "dependencies": [ + "platform", + "platform_dsl_store", + "platform_dsl_mapping", + "platform_store_relational", + "core_functions_json", + "core_functions_standard", + "core_functions_unclassified", + "core" + ] +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/core_executable_test_wrapper/testWrapper.pure b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/core_executable_test_wrapper/testWrapper.pure new file mode 100644 index 00000000000..71834c798b4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure/src/main/resources/core_executable_test_wrapper/testWrapper.pure @@ -0,0 +1,102 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// ###Pure +// import meta::analytics::lineage::*; +// import meta::pure::lineage::*; +// import meta::relational::tests::model::simple::*; +// import meta::relational::tests::mapping::association::embedded::*; +// function meta::pure::test::testWrapper::testPersonToOrganisationsExample():Boolean[1] +// { +// meta::relational::tests::mapping::association::embedded::setUp(); +// let result = meta::pure::test::testWrapper::testWrapper(|Person.all()->project([p|$p.lastName,p|$p.firm.legalName, p|$p.firm.organizations.name], ['name', 'firm', 'team']), associationMapping, meta::external::store::relational::tests::testRuntime(), meta::relational::extension::relationalExtensions()); +// let lineage = $result->meta::pure::test::testWrapper::getLineage(); +// assertLineage(['Lambda', 'db_myDB', 'tb_myDBdefaultORGANIZATIONS', 'tb_myDBdefaultPERSON_FIRM_DENORM'], ['Lambda', 'meta::relational::tests::model::simple::Firm', 'meta::relational::tests::model::simple::Organization', 'meta::relational::tests::model::simple::Person', 'pack_meta::relational::tests::model::simple'],'[firm: [PERSON_FIRM_DENORM.FIRM_LEGALNAME ], name: [PERSON_FIRM_DENORM.PERSON_LASTNAME ], team: [ORGANIZATIONS.FIRM_ID , ORGANIZATIONS.NAME , PERSON_FIRM_DENORM.FIRM_ID ]]',$lineage); +// let tds= $result->meta::pure::test::testWrapper::getTabularDatasetResult().values->at(0); +// assertEquals(5, $tds.rows->size()); +// assertSameElements(['Smith Firm X Team 1', 'Smith Firm X Team 2', 'Johnson Firm X Team 1', 'Johnson Firm X Team 2', 'Roberts Firm A Team 3'], $tds.rows->map(r|$r.getString('name')+' '+$r.getString('firm')->toString()+ ' ' +$r.getString('team'))); +// } + + + +###Pure +import meta::analytics::lineage::*; +import meta::core::runtime::*; +import meta::pure::mapping::*; +import meta::pure::test::testWrapper::*; +function meta::pure::test::testWrapper::getLineage(result:Map[1]):meta::pure::lineage::result::LineageResult[1] +{ +$result->get(TestType.lineage)->cast(@meta::pure::test::testWrapper::LineageResult).result->toOne(); + +} + +function meta::pure::test::testWrapper::getTabularDatasetResult(result:Map[1]):meta::pure::mapping::Result[1] +{ +$result->get(TestType.execution)->cast(@ExecuteResult).result->toOne(); + +} + +function meta::pure::test::testWrapper::testWrapper(f:FunctionDefinition<{->T[y]}>[1], m:Mapping[1], runtime:Runtime[1], extensions:meta::pure::extension::Extension[*]):Map[1] +{ + + newMap([meta::pure::test::testWrapper::executeWrapper($f,$m,$runtime,$extensions), + meta::pure::test::testWrapper::lineageWrapper($f,$m,$runtime,$extensions) + ]); +} + +function meta::pure::test::testWrapper::executeWrapper(f:FunctionDefinition<{->T[y]}>[1], m:Mapping[1], runtime:Runtime[1], extensions:meta::pure::extension::Extension[*]):Pair[1] +{ + pair(TestType.execution,^ExecuteResult(result=meta::pure::router::execute($f,$m,$runtime,$extensions))); +} + +function meta::pure::test::testWrapper::lineageWrapper(f:FunctionDefinition<{->T[y]}>[1], m:Mapping[1], runtime:Runtime[1], extensions:meta::pure::extension::Extension[*]):Pair[1] +{ + let fStr = 'meta::analytics::lineage::computeTestLineage_FunctionDefinition_1__Mapping_1__Runtime_$0_1$__Extension_MANY__LineageResult_1_'; + let func = $fStr->pathToElement()->cast(@Function<{FunctionDefinition[1], Mapping[1], Runtime[1], meta::pure::extension::Extension[*]->meta::pure::lineage::result::LineageResult[1]}>); + $func->eval($f, $m,$runtime, $extensions); + pair(TestType.lineage,^meta::pure::test::testWrapper::LineageResult(result= $func->eval($f, $m,$runtime, $extensions))); +} + +Enum meta::pure::test::testWrapper::TestType +{ + execution, + lineage +} + +Class meta::pure::test::testWrapper::Result +{ + +} + +Class meta::pure::test::testWrapper::ExecuteResult extends meta::pure::test::testWrapper::Result +{ + result:meta::pure::mapping::Result[1]; + +} + +Class meta::pure::test::testWrapper::LineageResult extends meta::pure::test::testWrapper::Result +{ + result:meta::pure::lineage::result::LineageResult[1]; +} + + +function <> meta::pure::test::testWrapper::resultLineageToString(reportLineage:meta::pure::lineage::result::ResultLineage[1]):String[1] +{ + $reportLineage.properties->map(c | $c.propertyName + '-' + $c.resultDetail)->sort()->joinStrings('[', ', ', ']'); +} + +function meta::pure::test::testWrapper::assertLineage(storeLineage:String[*], classLineage:String[*], reportLineage:String[1], result:meta::pure::lineage::result::LineageResult[1]):Boolean[1] +{ + assertSameElements($storeLineage, $result.storeLineage.nodes.data.id) && assertSameElements($classLineage, $result.classLineage.nodes.data.id) && assertEquals($reportLineage, meta::pure::test::testWrapper::resultLineageToString($result.resultLineage)); +} diff --git a/legend-engine-core/legend-engine-core-testable/pom.xml b/legend-engine-core/legend-engine-core-testable/pom.xml index d0943f3e7f5..3ffbd08b837 100644 --- a/legend-engine-core/legend-engine-core-testable/pom.xml +++ b/legend-engine-core/legend-engine-core-testable/pom.xml @@ -36,5 +36,6 @@ legend-engine-testable-http-api legend-engine-execution-test-data-generation legend-engine-execution-test-data-generation-api + legend-engine-executable-test-pure \ No newline at end of file diff --git a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java index 805e1a346eb..a224abf8bf6 100644 --- a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java +++ b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java @@ -122,6 +122,8 @@ protected MutableList buildRepositories(SourceLocationCon .with(this.buildCore("legend-engine-xts-dataquality/legend-engine-xt-dataquality-pure", "dataquality")) .with(this.buildCore("legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlPlanning-pure", "external-store-relational-sql-planning")) .with(this.buildCore("legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlDialectTranslation-pure", "external-store-relational-sql-dialect-translation")) + .with(this.buildCore("legend-engine-core/legend-engine-core-testable/legend-engine-executable-test-pure", "executable-test-wrapper")) + ; } diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage/fullAnalytics.pure b/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage/fullAnalytics.pure index c99afa14ddb..734dfd65ef5 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage/fullAnalytics.pure +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage/fullAnalytics.pure @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import meta::pure::lineage::graph::*; import meta::pure::executionPlan::*; import meta::core::runtime::*; import meta::pure::lineage::scanRelations::*; @@ -80,6 +81,86 @@ Class meta::analytics::lineage::PropertyElement type : String[0..1]; } +Class meta::analytics::lineage::InternalLineageResult +{ + databaseLineage : Graph[1]; + relationTree : RelationTree[1]; + classLineage : Graph[1]; + functionTrees : PropertyPathTree[*]; + reportLineage : ReportLineage[1]; +} + + +function <> meta::analytics::lineage::computeLineageInternal(f:FunctionDefinition[1], m:Mapping[1], r:Runtime[0..1], extensions:meta::pure::extension::Extension[*]):meta::analytics::lineage::InternalLineageResult[1] +{ + let mappings = if($r->isEmpty(), |$m, |$m->concatenate(getMappingsFromRuntime($r->toOne()))); + let modelToModelMappings = $mappings->init(); + + let sourceMapping = $mappings->last()->toOne(); + let funcBody = $f.expressionSequence->evaluateAndDeactivate(); + let updatedFuncBody = $funcBody->map(e|$e->meta::pure::lineage::analytics::inlineQualifiedProperties(newMap([]->cast(@Pair), VariableExpression->classPropertyByName('name')->cast(@Property)), $f->openVariableValues(), $extensions)); + let propertyTrees = $updatedFuncBody->map(e|$e->buildMultiLevelPropertyTrees($modelToModelMappings, $extensions)); + + let combinedTrees = if( $propertyTrees->size()>1,|$propertyTrees->first()->toOne()->findAndAddChildrenAtTheEnd([],$propertyTrees->tail()),|$propertyTrees->toOne()); + + let reprocessedFuncBody = if($modelToModelMappings->isEmpty() && $mappings->size() == 1, + |$updatedFuncBody, + |$updatedFuncBody->map(e|$e->cast(@FunctionExpression)->meta::pure::mapping::modelToModel::chain::allReprocess([], $modelToModelMappings, $extensions, noDebug()).res)); + + let vars = $f->functionType().parameters->evaluateAndDeactivate()->map(p| pair($p.name, ^List(values = ^PlanVarPlaceHolder(name=$p.name, type = $p.genericType.rawType->toOne(), multiplicity=$p.multiplicity)))); + let relationTree = if($f->functionReturnType().rawType->toOne()->_subTypeOf(TabularDataSet) && $r->isNotEmpty() && $modelToModelMappings->isEmpty(), + | scanRelations(^LambdaFunction<{->Any[*]}>(expressionSequence = $funcBody), $sourceMapping, $r->toOne(), $vars, noDebug(), $extensions), + | scanRelations($combinedTrees->last()->toOne(), $sourceMapping)); + let classLineageMapping = if($modelToModelMappings->isEmpty() && $mappings->size() == 1, | $sourceMapping, | $modelToModelMappings); + + ^InternalLineageResult + ( + databaseLineage = $f->toFlowDatabase($sourceMapping, $combinedTrees, $r)->toGraph(), + classLineage = $f->toFlowClass($combinedTrees, $classLineageMapping)->toGraph(), + functionTrees = $combinedTrees, + relationTree = $relationTree, + reportLineage = buildReportLineage($reprocessedFuncBody->last()->toOne(), $sourceMapping,$vars->newMap()) + ); + +} + + +function meta::analytics::lineage::computeTestLineage(f:FunctionDefinition[1], m:Mapping[1], r:Runtime[0..1], extensions:meta::pure::extension::Extension[*]):meta::pure::lineage::result::LineageResult[1] +{ + let lineage = meta::analytics::lineage::computeLineageInternal($f,$m,$r,$extensions); + ^meta::pure::lineage::result::LineageResult(storeLineage=$lineage.databaseLineage, + classLineage=$lineage.classLineage, + resultLineage= $lineage.reportLineage->reportLineageToResult() ); + +} + +function meta::analytics::lineage::reportLineageToResult(report:ReportLineage[1]):meta::pure::lineage::result::ResultLineage[1] +{ + ^meta::pure::lineage::result::ResultLineage(properties=$report.columns->map(c | ^meta::pure::lineage::result::PropertyLineage(propertyName=$c.name, resultDetail= $c.columns->map(t|$t.column.owner->cast(@Table).name->toOne()+'.'+$t.column.name->toOne()+' <'+$t.context+'>')->removeDuplicates()->sort()->makeString(': [', ', ', ']')->sort()->joinStrings('[', ', ', ']')))); +} + +// Class meta::pure::lineage::result::PropertyLineage +// { +// propertyName : String[1]; +// resultDetail : String[1]; +// } + +// Class meta::pure::lineage::result::ResultLineage +// { +// properties : PropertyLineage[*]; +// } + + +// Class meta::pure::lineage::result::LineageResult +// { +// storeLineage: meta::pure::lineage::graph::Graph[1]; +// classLineage: meta::pure::lineage::graph::Graph[1]; +// resultLineage : ResultLineage[1]; +// } + + + + function meta::analytics::lineage::computeLineage(f:FunctionDefinition[1], m:Mapping[1], r:Runtime[0..1], extensions:meta::pure::extension::Extension[*]):FunctionAnalytics[1] { let mappings = if($r->isEmpty(), |$m, |$m->concatenate(getMappingsFromRuntime($r->toOne()))); @@ -111,6 +192,11 @@ function meta::analytics::lineage::computeLineage(f:FunctionDefinition[1], ); } + + + + + function meta::analytics::lineage::computeLineage(f:FunctionDefinition[1], m:Mapping[1], extensions:meta::pure::extension::Extension[*]):FunctionAnalytics[1] { computeLineage($f, $m, [], $extensions); diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage/graph.pure b/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage/graph.pure index e9398d6fae1..c62e04647b6 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage/graph.pure +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage/graph.pure @@ -13,6 +13,7 @@ // limitations under the License. +import meta::pure::lineage::graph::*; import meta::analytics::lineage::flow::*; import meta::analytics::lineage::graph::*; import meta::json::*; @@ -21,39 +22,39 @@ import meta::relational::metamodel::*; import meta::relational::metamodel::relation::*; -Class meta::analytics::lineage::graph::Node -{ - data : NodeData[1]; -} - -Class meta::analytics::lineage::graph::NodeData -{ - id : String[1]; - text : String[1]; - type : String[1]; - displayType : String[0..1]; - parent : Node[0..1]; -} - -Class meta::analytics::lineage::graph::Edge -{ - data : EdgeData[1]; -} - -Class meta::analytics::lineage::graph::EdgeData -{ - id : String[1]; - text : String[1]; - type : String[1]; - source : Node[1]; - target : Node[1]; -} - -Class meta::analytics::lineage::graph::Graph -{ - nodes : Node[*]; - edges : Edge[*]; -} +// Class meta::analytics::lineage::graph::Node +// { +// data : NodeData[1]; +// } + +// Class meta::analytics::lineage::graph::NodeData +// { +// id : String[1]; +// text : String[1]; +// type : String[1]; +// displayType : String[0..1]; +// parent : Node[0..1]; +// } + +// Class meta::analytics::lineage::graph::Edge +// { +// data : EdgeData[1]; +// } + +// Class meta::analytics::lineage::graph::EdgeData +// { +// id : String[1]; +// text : String[1]; +// type : String[1]; +// source : Node[1]; +// target : Node[1]; +// } + +// Class meta::analytics::lineage::graph::Graph +// { +// nodes : Node[*]; +// edges : Edge[*]; +// } function meta::analytics::lineage::graph::toJSON(graph : Graph[1]):JSONElement[1] { diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/pom.xml index 0a9f991023e..dd7bdded6b4 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/pom.xml @@ -125,6 +125,12 @@ legend-engine-language-pure-dsl-service-pure ${project.version} + + org.finos.legend.engine + legend-engine-executable-test-pure + ${project.version} + + @@ -207,7 +213,11 @@ legend-pure-runtime-java-extension-compiled-store-relational ${legend.pure.version} - + + org.finos.legend.engine + legend-engine-executable-test-pure + ${project.version} + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational.definition.json index 73d3c99e80a..94f3e21cafd 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational.definition.json @@ -14,6 +14,7 @@ "core_functions_relation", "core_functions_unclassified", "core_service", - "core" + "core", + "core_executable_test_wrapper" ] } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/tests/mapping/association/testAssociationEmbedded.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/tests/mapping/association/testAssociationEmbedded.pure index a297279e530..3eeaa780538 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/tests/mapping/association/testAssociationEmbedded.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/tests/mapping/association/testAssociationEmbedded.pure @@ -33,7 +33,10 @@ function <> meta::relational::tests::mapping::association::e function <> meta::relational::tests::mapping::association::embedded::testPersonToOrganisations():Boolean[1] { - let result1 = execute(|Person.all()->project([p|$p.lastName,p|$p.firm.legalName, p|$p.firm.organizations.name], ['name', 'firm', 'team']), associationMapping, meta::external::store::relational::tests::testRuntime(), meta::relational::extension::relationalExtensions()).values->at(0); + let testWrapper = meta::pure::test::testWrapper::testWrapper(|Person.all()->project([p|$p.lastName,p|$p.firm.legalName, p|$p.firm.organizations.name], ['name', 'firm', 'team']), associationMapping, meta::external::store::relational::tests::testRuntime(), meta::relational::extension::relationalExtensions()); + let result1 =$testWrapper->meta::pure::test::testWrapper::getTabularDatasetResult().values->at(0); + let lineage = $testWrapper->meta::pure::test::testWrapper::getLineage(); + //meta::pure::test::testWrapper::assertLineage(['z'],['z'],'',$lineage); assertEquals(5, $result1.rows->size()); assertSameElements(['Smith Firm X Team 1', 'Smith Firm X Team 2', 'Johnson Firm X Team 1', 'Johnson Firm X Team 2', 'Roberts Firm A Team 3'], $result1.rows->map(r|$r.getString('name')+' '+$r.getString('firm')->toString()+ ' ' +$r.getString('team'))); }