Skip to content

Commit 406282f

Browse files
committed
Merge branch 'fix/cost-evidence-dataset' into impl/sds-stack-742
2 parents 3a6d83c + d56f5d5 commit 406282f

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

‎control_plane/src/physical/compiler.rs‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,12 @@ impl DeploymentPlanCompiler {
14491449
validate_evidence(&query.query_id, e, &environment)?;
14501450
}
14511451
let node = query.selected_plan_root.clone();
1452-
reject_uncertified_readouts(&query.query_id, &node, environment.target)?;
1452+
reject_uncertified_readouts(
1453+
&query.query_id,
1454+
&node,
1455+
&query.accuracy_target,
1456+
environment.target,
1457+
)?;
14531458
let selected = if super::maintained_population::supported_node(&node) {
14541459
Vec::new()
14551460
} else {
@@ -1463,7 +1468,12 @@ impl DeploymentPlanCompiler {
14631468
})?
14641469
};
14651470
if !selected.is_empty() {
1466-
reject_uncertified_readouts(&query.query_id, &node, environment.target)?;
1471+
reject_uncertified_readouts(
1472+
&query.query_id,
1473+
&node,
1474+
&query.accuracy_target,
1475+
environment.target,
1476+
)?;
14671477
}
14681478
let selected = selected
14691479
.into_iter()
@@ -4003,6 +4013,7 @@ fn validate_executable_subdag(node: &Rc<SummaryNode>) -> Result<(), String> {
40034013
fn reject_uncertified_readouts(
40044014
query_id: &str,
40054015
root: &Rc<SummaryNode>,
4016+
accuracy: &AccuracyTarget,
40064017
target: PhysicalDeploymentTarget,
40074018
) -> Result<(), CompileError> {
40084019
let dag = planner_types::post_asap::compile_executable_dag(root).map_err(|error| {
@@ -4011,6 +4022,25 @@ fn reject_uncertified_readouts(
40114022
reason: format!("invalid executable subDAG: {error}"),
40124023
}
40134024
})?;
4025+
// Leaf guarantees do not certify a composition (for example, division of
4026+
// two approximate quantiles). Admission checks the complete query result.
4027+
if dag.nodes.iter().any(|node| {
4028+
matches!(
4029+
node.payload,
4030+
planner_types::post_asap::ExecutableOperatorPayload::SummaryEstimate { .. }
4031+
)
4032+
}) && root.guarantee.as_ref().is_none_or(|guarantee| {
4033+
!asap_aware_mapping::accuracy::AccuracyModel::satisfies(
4034+
&DefaultAccuracyModel,
4035+
guarantee,
4036+
accuracy,
4037+
)
4038+
}) {
4039+
return Err(CompileError::Query {
4040+
query_id: query_id.into(),
4041+
reason: "selected query result has no certified accuracy guarantee satisfying the requested accuracy".into(),
4042+
});
4043+
}
40144044
for node in &dag.nodes {
40154045
if target != PhysicalDeploymentTarget::BackendLocalRemoteWrite
40164046
&& node.guarantee.as_ref().is_some_and(|guarantee| {

0 commit comments

Comments
 (0)