Skip to content

Commit

Permalink
Add support for relaxed version of extractRuntimeFromFunction (#2296)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardikmaheshwari authored Sep 25, 2023
1 parent fe4700f commit 473c8d5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,18 @@ function <<meta::pure::profiles::test.Test>> meta::external::format::shared::exe
assertEquals($expected, $planString);
}

function <<meta::pure::profiles::test.Test>> meta::external::format::shared::executionPlan::tests::testExtractRuntimeOnChainingQuery(): Boolean[1]
{
let binding = testBinding();
let tree = #{TargetPerson{fullName}}#;

let query = {data:Byte[*]| TargetPerson.all()->graphFetch($tree)->from(M2MMapping, mergeRuntimes([^Runtime(connections = ^ModelChainConnection(element=^ModelStore(), mappings = M2MMapping1)), getRuntimeWithModelQueryConnection(_Person, $binding, $data)]))->externalize($binding, $tree);};
assertEmpty($query->extractRuntimesFromFunctionDefinition(true));

let query1 = {data:Byte[*]| TargetPerson.all()->graphFetch($tree)->from(M2MMapping, getRuntimeWithModelQueryConnection(_Person, $binding, $data))->externalize($binding, $tree);};
assertEmpty($query1->extractRuntimesFromFunctionDefinition(true));
}

function <<access.private>> meta::external::format::shared::executionPlan::tests::testBinding(): Binding[1]
{
^Binding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,16 @@ function <<access.private>> meta::pure::functions::meta::findExpressionsForFunct
}

function meta::pure::functions::meta::extractRuntimesFromFunctionDefinition(func:FunctionDefinition<Any>[1]):Runtime[*]
{
extractRuntimesFromFunctionDefinition($func, false)
}

function meta::pure::functions::meta::extractRuntimesFromFunctionDefinition(func:FunctionDefinition<Any>[1], filterBeforeCast:Boolean[1]):Runtime[*]
{
let fromExprList = $func->findExpressionsForFunctionInFunctionDefinition([from_TabularDataSet_1__Mapping_1__Runtime_1__ExecutionContext_1__TabularDataSet_1_,
from_TabularDataSet_1__Mapping_1__Runtime_1__TabularDataSet_1_,
from_T_m__Mapping_1__Runtime_1__T_m_]);
$fromExprList->evaluateAndDeactivate()->map(exp | $exp.parametersValues->at(2)->evaluateAndDeactivate()->cast(@InstanceValue).values)->cast(@Runtime);
$fromExprList->evaluateAndDeactivate()->map(exp | $exp.parametersValues->at(2)->evaluateAndDeactivate()->filter(p | !$filterBeforeCast || $p->instanceOf(InstanceValue))->cast(@InstanceValue).values)->cast(@Runtime);
}

function meta::pure::functions::meta::findPropertiesInValueSpecification(vs:ValueSpecification[1]):AbstractProperty<Any>[*]
Expand Down

0 comments on commit 473c8d5

Please sign in to comment.