Skip to content

Commit c4aa70b

Browse files
zzylolclaude
andcommitted
fix: apply native lifecycle pricing to preferred typed candidates
Preserve the priced physical realization instead of recompiling it after window preparation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 30d75fc commit c4aa70b

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

‎control_plane/src/physical/compiler.rs‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,14 +1043,31 @@ impl BackendLocalPlanningInput {
10431043
self.physical_inputs.erp.as_ref(),
10441044
self.environment.observed_at_unix_ms,
10451045
)?;
1046-
for query in &mut queries {
1046+
for (index, query) in queries.iter_mut().enumerate() {
1047+
// The preferred typed root can itself have a native realization;
1048+
// apply the same lifecycle pricing as the alternative forests.
1049+
if let Some(timed) = placement::time_native_candidate(
1050+
&query.selected_plan_root,
1051+
query,
1052+
&workload,
1053+
&data_workload,
1054+
index,
1055+
&self.environment,
1056+
&self.physical_inputs,
1057+
) {
1058+
query.selected_plan_root = timed.root;
1059+
query.retain(Some(timed.physical))?;
1060+
planner_selection_trace.extend(timed.trace);
1061+
}
10471062
prepare_window_implementations(
10481063
query,
10491064
&self.physical_inputs.window_cost_model,
10501065
self.environment.target,
10511066
self.physical_inputs.query_retention_margin_ms,
10521067
)?;
1053-
query.retain_physical_candidate()?;
1068+
if query.physical_candidate.is_none() {
1069+
query.retain_physical_candidate()?;
1070+
}
10541071
}
10551072
let mut planner_candidate_forests = Vec::new();
10561073
// Native physical realizations need the complete series identity in

0 commit comments

Comments
 (0)