From f2773364b36a630249734da0808fd3130a033cee Mon Sep 17 00:00:00 2001 From: "Sherjan, Haroon" <35983762+haroonsherjan@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:55:39 -0500 Subject: [PATCH] Bugfix ModelJoin and RtoM2M CrossStore interaction (#2561) * Bugfix ModelJoin and RtoM2M CrossStore interaction * Bugfix ModelJoin and RtoM2M CrossStore interaction --- .../src/main/resources/core/pure/router/store/routing.pure | 7 ++++--- .../src/main/resources/core/pure/store/storeContract.pure | 2 +- .../core_relational/relational/contract/storeContract.pure | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/legend-engine-pure/legend-engine-pure-code/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/store/routing.pure b/legend-engine-pure/legend-engine-pure-code/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/store/routing.pure index 618fc7eb671..29218f50d5c 100644 --- a/legend-engine-pure/legend-engine-pure-code/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/store/routing.pure +++ b/legend-engine-pure/legend-engine-pure-code/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/store/routing.pure @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import meta::pure::store::*; import meta::pure::metamodel::relation::*; import meta::relational::metamodel::*; import meta::pure::extension::*; @@ -77,10 +78,10 @@ function <> meta::pure::router::store::routing::modifyMappingBas | let connection = $inScopeStores->map(s|$runtime->connectionByElementFailSafe($s))->distinct(); if( $connection->size() == 1, - | $connection->toOne()->match( + | $inScopeStores->match( $extensions.availableStores.localizeXStoreAssociation - ->map(e|$e->eval($x, $inScopeClassMappings, $inScopeStores)) - ->concatenate([a:Connection[1] | $x;])->toOneMany() + ->map(e|$e->eval($x, $inScopeClassMappings)) + ->concatenate([a:Store[*] | $x;])->toOneMany() );, | $x );, diff --git a/legend-engine-pure/legend-engine-pure-code/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/store/storeContract.pure b/legend-engine-pure/legend-engine-pure-code/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/store/storeContract.pure index 948c20fe06e..5e361d8cdc0 100644 --- a/legend-engine-pure/legend-engine-pure-code/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/store/storeContract.pure +++ b/legend-engine-pure/legend-engine-pure-code/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/store/storeContract.pure @@ -17,7 +17,7 @@ Class meta::pure::store::StoreContract extends meta::pure::router::extension::Ro supports : Function<{FunctionExpression[1]->Boolean[1]}>[0..1]; supportsNativeJoinAmongElements : Boolean[1]; isPropertyAutoMapped : Function<{AbstractProperty[1], InstanceSetImplementation[1]->Boolean[1]}>[0..1]; - localizeXStoreAssociation : Function<{XStoreAssociationImplementation[1], SetImplementation[*], Store[*] -> Function<{Nil[1]->AssociationImplementation[1]}>[*]}>[0..1]; + localizeXStoreAssociation : Function<{XStoreAssociationImplementation[1], SetImplementation[*] -> Function<{Nil[1]->AssociationImplementation[1]}>[*]}>[0..1]; // ------------------------------------------------------------------------------------------ Routing // ExecutionPlan Generation ------------------------------------------------------------------------- diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/contract/storeContract.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/contract/storeContract.pure index f22177c37e2..7d5196c380e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/contract/storeContract.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/contract/storeContract.pure @@ -45,9 +45,9 @@ function meta::relational::contract::relationalStoreContract():StoreContract[1] planGraphFetchExecution = meta::relational::contract::planGraphFetchExecution_StoreMappingLocalGraphFetchExecutionNodeGenerationInput_1__LocalGraphFetchExecutionNode_1_, planCrossGraphFetchExecution = meta::relational::contract::planCrossGraphFetchExecution_StoreMappingCrossLocalGraphFetchExecutionNodeGenerationInput_1__LocalGraphFetchExecutionNode_1_, localizeXStoreAssociation = { - x : XStoreAssociationImplementation[1], setImpl : SetImplementation[*], stores : Store[*] | + x : XStoreAssociationImplementation[1], setImpl : SetImplementation[*] | [ - d: DatabaseConnection[1]| meta::external::store::relational::modelJoins::localizeXStoreAssociation($x, $setImpl, $stores); + d: Database[*]| meta::external::store::relational::modelJoins::localizeXStoreAssociation($x, $setImpl, $d); ] }, connectionEquality = { b : Connection [1] |