@@ -583,6 +583,8 @@ struct PhysicalPlanQueryRequest {
583583 accuracy : types_v2:: AccuracyTarget ,
584584 lifecycle : physical:: compiler:: LifecyclePlanningInput ,
585585 window_implementations : Vec < physical:: compiler:: WindowImplementationCandidate > ,
586+ #[ serde( default ) ]
587+ runtime_policy : physical:: compiler:: RuntimeRulePolicy ,
586588}
587589
588590#[ derive( Debug , Deserialize ) ]
@@ -593,6 +595,8 @@ struct CompileAndPublishPhysicalPlanRequest {
593595 capability_snapshot_id : String ,
594596 #[ serde( default ) ]
595597 evidence : HashMap < String , physical:: compiler:: TopKMembershipEvidence > ,
598+ #[ serde( default ) ]
599+ runtime_adaptation_evidence : Vec < physical:: compiler:: RuntimeAdaptationEvidence > ,
596600 planner_revision : String ,
597601 max_evidence_age_ms : u64 ,
598602 plan_version : u64 ,
@@ -624,10 +628,11 @@ async fn handle_compile_and_publish_physical_plan(
624628 State ( st) : State < AppState > ,
625629 Json ( request) : Json < CompileAndPublishPhysicalPlanRequest > ,
626630) -> impl IntoResponse {
627- let ( bundle, collector_ids, apply_timeout) = match compile_physical_plan_request ( request) {
628- Ok ( compiled) => compiled,
629- Err ( response) => return response. into_response ( ) ,
630- } ;
631+ let ( bundle, collector_ids, apply_timeout, adaptation_evidence) =
632+ match compile_physical_plan_request ( request) {
633+ Ok ( compiled) => compiled,
634+ Err ( response) => return response. into_response ( ) ,
635+ } ;
631636
632637 let Some ( backend) = st. backend_client . as_ref ( ) else {
633638 return (
@@ -654,6 +659,7 @@ async fn handle_compile_and_publish_physical_plan(
654659 bundle. backend_plan . encode_to_vec ( ) ,
655660 & bundle. query_plan ,
656661 None ,
662+ & adaptation_evidence,
657663 )
658664 . await
659665 {
@@ -714,7 +720,15 @@ async fn handle_compile_and_publish_physical_plan(
714720// Only the Send-safe compiled bundle crosses an await point.
715721fn compile_physical_plan_request (
716722 request : CompileAndPublishPhysicalPlanRequest ,
717- ) -> Result < ( physical:: compiler:: PhysicalPlan , Vec < String > , Duration ) , ( StatusCode , String ) > {
723+ ) -> Result <
724+ (
725+ physical:: compiler:: PhysicalPlan ,
726+ Vec < String > ,
727+ Duration ,
728+ Vec < physical:: compiler:: RuntimeAdaptationEvidence > ,
729+ ) ,
730+ ( StatusCode , String ) ,
731+ > {
718732 if request. queries . is_empty ( ) || request. collector_ids . is_empty ( ) {
719733 return Err ( (
720734 StatusCode :: UNPROCESSABLE_ENTITY ,
@@ -780,6 +794,7 @@ fn compile_physical_plan_request(
780794 accuracy : query. accuracy ,
781795 lifecycle : query. lifecycle ,
782796 window_implementations : query. window_implementations ,
797+ runtime_policy : query. runtime_policy ,
783798 } ) ;
784799 }
785800
@@ -804,7 +819,12 @@ fn compile_physical_plan_request(
804819 Err ( error) => return Err ( ( StatusCode :: UNPROCESSABLE_ENTITY , error. to_string ( ) ) ) ,
805820 } ;
806821 let apply_timeout = Duration :: from_millis ( request. apply_timeout_ms ) ;
807- Ok ( ( bundle, request. collector_ids , apply_timeout) )
822+ Ok ( (
823+ bundle,
824+ request. collector_ids ,
825+ apply_timeout,
826+ request. runtime_adaptation_evidence ,
827+ ) )
808828}
809829
810830// ── Handlers ──────────────────────────────────────────────────────────────────
0 commit comments