Skip to content

Commit

Permalink
add support for pushing down sql enum transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
AFine-gs committed Jan 9, 2024
1 parent 46e9484 commit 5a729a3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ public Handlers(PureModel pureModel)
register(m(h("meta::pure::mutation::save_T_MANY__RootGraphFetchTree_1__Mapping_1__Runtime_1__T_MANY_", false, ps -> res(ps.get(0)._genericType(), "zeroMany"), ps -> true)));

register("meta::pure::tds::extensions::firstNotNull_T_MANY__T_$0_1$_", false, ps -> res(ps.get(0)._genericType(), "zeroOne"));

register("meta::pure::functions::hash::hash_String_1__HashType_1__String_1_", true, ps -> res("String","one"));

// Extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Class meta::pure::router::routing::RoutingState
value : Any[0..1];
executionContext: ExecutionContext[1] = ^ExecutionContext();
graphFetchFlow : Boolean[0..1];
executionContext: ExecutionContext[1] = ^ExecutionContext();
}

Class meta::pure::router::routing::PropertyMap
Expand Down Expand Up @@ -141,7 +142,7 @@ function <<access.private>> meta::pure::router::routing::routeValueSpecification
if($i.values->size() == 1 && $i.values->at(0)->instanceOf(RelationStoreAccessor),
| $state.routingStrategy.processRelationStoreAccessor($i.values->at(0)->cast(@RelationStoreAccessor<Any>), $i, $state, $executionContext, $debug);,
| $state
);
);
),
pair(
|$i->isOneClass() || ($i.values->isEmpty() && $i.multiplicity == PureOne && $i.genericType.rawType->isNotEmpty() && $i.genericType.rawType->toOne()->instanceOf(Class)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function meta::relational::contract::planExecution(sq:meta::pure::mapping::Store
->generateExecutionNodeForPostProcessedResult($sq, $store, $ext, $m->toOne(), $storeRuntime, $exeCtx, $debug, $extensions);
);

);

}

function meta::relational::contract::postProcessorsMatch(postProcessors1: meta::pure::alloy::connections::PostProcessor[*], postProcessors2: meta::pure::alloy::connections::PostProcessor[*]): Boolean[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ function <<access.private>> meta::relational::graphFetch::executionPlan::generat
});
}

function <<access.private>> meta::relational::graphFetch::executionPlan::buildBaseQueryForChild(setImpls: RelationalInstanceSetImplementation[*], pureToSqlState: State[1], mc: TemporalMilestoningContext[0..1], extensions: Extension[*], debug: DebugContext[1]):SelectWithCursor[1]
function <<access.private>> meta::relational::graphFetch::executionPlan::buildBaseQueryForChild(setImpls: RelationalInstanceSetImplementation[*], pureToSqlState: State[1], mc: TemporalMilestoningContext[0..1],exeCtx:ExecutionContext[1], extensions: Extension[*], debug: DebugContext[1]):SelectWithCursor[1]
{
let isQualified = $propTree.property->instanceOf(QualifiedProperty);
let pureToSqlState = defaultState($mapping, $inScopeVars, $exeCtx, $extensions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function meta::relational::mapping::generateInstantiationExecutionNode(sq:meta::
name = $p.first,
type = $p.second.type->cast(@meta::pure::metamodel::type::DataType),
documentation = $p.second.documentation,
enumMappingId = if($exeCtx->contextHasFlag(meta::pure::executionPlan::features::Feature.PUSH_DOWN_ENUM_TRANSFORM),|[] ,| $p.second.propertyMapping->match([r:RelationalPropertyMapping[0..1] | $r.transformer->cast(@EnumerationMapping<Any>).name, p:PropertyMapping[0..1] | []])),
enumMappingId = if($exeCtx->contextHasFlag(meta::pure::executionPlan::features::Feature.PUSH_DOWN_ENUM_TRANSFORM),|[] ,| $p.second.propertyMapping->match([r:RelationalPropertyMapping[0..1] | $r.transformer->cast(@EnumerationMapping<Any>).name, p:PropertyMapping[0..1] | []])),
offset = $paths->indexOf($p),
sourceDataType = if($p.second.relationalType->isNotEmpty(),
| $p.second.relationalType,
Expand Down

0 comments on commit 5a729a3

Please sign in to comment.