Skip to content

Commit

Permalink
Revert "Fixes to handle M2M mappings (#2973)" (#2978)
Browse files Browse the repository at this point in the history
This reverts commit 50b3f28.
  • Loading branch information
aziemchawdhary-gs authored Jul 24, 2024
1 parent d4686ef commit cc1e0ea
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import meta::pure::router::metamodel::clustering::*;
import meta::pure::milestoning::*;
import meta::pure::executionPlan::*;
import meta::pure::router::routing::*;
Expand Down Expand Up @@ -152,7 +151,7 @@ function meta::pure::mapping::modelToModel::chain::allReprocess(f:FunctionExpres
print(if(!$debug.debug, |'', | $debug.space+' Mapping: '+$a.name->toOne()+'\n'));
let rez = ^LambdaFunction<{->Any[*]}>(expressionSequence = $b.res->cast(@FunctionExpression))->routeFunction($a, ^Runtime(), $extensions, $debug);
print(if(!$debug.debug, |'', | $debug.space+' Routed: '+$rez->at(0)->asString()+'\n'));
let res = $rez.expressionSequence->evaluateAndDeactivate()->cast(@ClusteredValueSpecification).val->match(
let res = $rez.expressionSequence->evaluateAndDeactivate()->cast(@StoreMappingClusteredValueSpecification).val->match(
[
e:StoreMappingRoutedValueSpecification[1]|pair(list($e), $e.value->cast(@FunctionExpression)->toOne()->reprocess($e, $a, $mappings, [], $extensions).newExpression);,
f:FunctionExpression[1]|pair(list($r), $f->reprocess($r, $a, $mappings, [], $extensions).newExpression);
Expand Down Expand Up @@ -224,7 +223,6 @@ function meta::pure::mapping::modelToModel::chain::reprocess(vs:ValueSpecificati
);,
r:FunctionRoutedValueSpecification[1]|$r.value->reprocess($e, $mapping, $mappings, $r, $extensions);,
e:StoreMappingRoutedValueSpecification[1]|$e.value->reprocess($e, $mapping, $mappings, [], $extensions);,
s:StoreMappingClusteredValueSpecification[1] | $s.val->reprocess($e, $mapping, $mappings, [], $extensions);,
v:VariableExpression[1]| let newGenericType = if($v.genericType.rawType->toOne()->instanceOf(Class) && $e.sets->isNotEmpty(),| ^GenericType(rawType=$e.sets->at(0)->cast(@PureInstanceSetImplementation).srcClass), | $v.genericType);
^Res(
newExpression = ^$v(genericType=$newGenericType),
Expand Down Expand Up @@ -295,9 +293,7 @@ function meta::pure::mapping::modelToModel::chain::reprocess(vs:ValueSpecificati
d:Date[1]|$d,
b:Boolean[1]|$b,
f:Float[1]|$f,
e:Enumeration<Any>[1]|$e,
st:StoreMappingClusteredValueSpecification[1]| $st,
gft:meta::pure::graphFetch::GraphFetchTree[1] | $gft
e:Enumeration<Any>[1]|$e
]););
let values = $results->map(r|$r->match([v:Res[1]|$v.newExpression->match([i:InstanceValue[1]|$i.values,a:Any[1]|$a]),k:Any[1]|$k]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@
<groupId>org.finos.legend.pure</groupId>
<artifactId>legend-pure-m2-dsl-path-pure</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.pure</groupId>
<artifactId>legend-pure-m2-dsl-graph-pure</artifactId>
</dependency>
<dependency>
<groupId>org.finos.legend.pure</groupId>
<artifactId>legend-pure-m2-dsl-mapping-pure</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Class meta::analytics::lineage::PropertyElement
function meta::analytics::lineage::computeLineage(f:FunctionDefinition<Any>[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())));
let modelToModelMappings = if($mappings->size() == 1, | $mappings, | $mappings->init());
let modelToModelMappings = $mappings->init();
let sourceMapping = $mappings->last()->toOne();
let funcBody = $f.expressionSequence->at(0)->evaluateAndDeactivate();
let updatedFuncBody = $funcBody->meta::pure::lineage::analytics::inlineQualifiedProperties(newMap([]->cast(@Pair<VariableExpression, ValueSpecification>), VariableExpression->classPropertyByName('name')->cast(@Property<VariableExpression,String|1>)), $f->openVariableValues(), $extensions);
Expand Down Expand Up @@ -189,7 +189,7 @@ function meta::analytics::lineage::flowDatabase::toFlowDatabase(f:FunctionDefini
let dbs = $tables->map(r|$r->schema()).database->removeDuplicates();
let maturityTests = maturityTests();
^Flow(
functions = if($tables->size() == 0 && $dbs->size() == 0, | [], | $f),
functions = $f,
databases = $dbs,
tables = $tables->cast(@NamedRelation),
links = $tables->map(t|let db = $t->map(r|$r->schema()).database->toOne();
Expand Down Expand Up @@ -218,11 +218,7 @@ function meta::analytics::lineage::flowDatabase::toFlowDatabase(p:PropertyPathTr
sp:Property<Nil,Any|*>[1]|let propertyMappings = $wsets->map(s|$s->_propertyMappingsByPropertyName($pr.property.name->toOne()););
let isDataTypeProperty = !$pr.property.genericType.rawType->isEmpty() && $pr.property.genericType.rawType->toOne()->instanceOf(DataType);
if ($isDataTypeProperty,
| $propertyMappings->map(pm |$pm->match([
rpm: RelationalPropertyMapping[1] | $rpm->meta::analytics::lineage::flowDatabase::getTables(),
ppm: PurePropertyMapping[1] | [],
a: Any[*] | fail('Database lineage not support for given type of mapping: ' + $pm->typeName()); [];
])),
| $propertyMappings->cast(@RelationalPropertyMapping)->map(pm|$pm->meta::analytics::lineage::flowDatabase::getTables());,
| $propertyMappings->map(pm|processNonDataTypeProperty($p, $pm, $possiblePropertyTargetClasses, $m, $extraChildren))
);,
q:QualifiedProperty<Any>[1]|if($q->meta::pure::milestoning::hasGeneratedMilestoningPropertyStereotype(),
Expand Down

This file was deleted.

0 comments on commit cc1e0ea

Please sign in to comment.