Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
320 changes: 180 additions & 140 deletions control_plane/src/physical/compiler.rs

Large diffs are not rendered by default.

25 changes: 2 additions & 23 deletions control_plane/src/physical/compiler/placement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,31 +201,11 @@ pub(super) fn place(
.and_then(|root| raw_query_time_program(root).ok())
})
.collect();
// A leaf the query-time lowering can externalize reads Prometheus directly.
let externalizable = |state: &SummaryNode, query: usize| {
raw_bindable
&& (crate::query_plan::query_time::selected_counter_materialization(
&queries[query].query_string,
state,
)
.ok()
.flatten()
.is_some()
|| crate::query_plan::query_time::selected_range_max_materialization(
&queries[query].query_string,
state,
)
.ok()
.flatten()
.is_some())
};
let horizon = first.summary_lifecycle_inputs.horizon_seconds;
let mut ephemeral = vec![false; states.len()];
let mut decisions = Vec::new();
for (state_index, (state, consumers)) in states.iter().enumerate() {
let bindable = consumers
.iter()
.all(|&query| raw_programs[query].is_some() || externalizable(state, query));
let bindable = consumers.iter().all(|&query| raw_programs[query].is_some());
let lead = &queries[consumers[0]].summary_lifecycle_inputs;
let interval = consumers
.iter()
Expand Down Expand Up @@ -283,8 +263,7 @@ pub(super) fn place(
let mut changed = false;
for (query, owned) in query_states.iter().enumerate() {
let realizable = owned.iter().all(|state| {
index_of(state).is_some_and(|i| ephemeral[i])
&& (raw_programs[query].is_some() || externalizable(state, query))
index_of(state).is_some_and(|i| ephemeral[i]) && raw_programs[query].is_some()
});
if realizable {
continue;
Expand Down
12 changes: 0 additions & 12 deletions control_plane/src/physical/plan_dot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ fn query_node_label(node: &QueryPlanNode) -> String {
QueryPlanNode::Logical { operator, .. } => {
format!("Logical\n{}", query_time_label(operator))
}
QueryPlanNode::Scalar { value } => format!("Scalar\n{value}"),
QueryPlanNode::Binary { operator, .. } => format!("Binary\n{operator:?}"),
QueryPlanNode::ReduceSum { .. } => "ReduceSum".into(),
QueryPlanNode::ReadMaterialization { binding } => format!(
"ReadMaterialization\n{}\nwindow={}ms\nlookback={:?}",
binding.materialization.fingerprint(),
Expand All @@ -228,15 +225,6 @@ fn query_time_label(operator: &QueryTimeOperator) -> &'static str {
QueryTimeOperator::ExactSubquery { .. } => "ExactSubquery",
QueryTimeOperator::CandidateExactSubquery { .. } => "CandidateExactSubquery",
QueryTimeOperator::Scan { .. } => "Scan",
QueryTimeOperator::UnaryNegate => "UnaryNegate",
QueryTimeOperator::VectorToScalar => "VectorToScalar",
QueryTimeOperator::Aggregate { .. } => "Aggregate",
QueryTimeOperator::Limit { .. } => "Limit",
QueryTimeOperator::Binary { .. } => "Binary",
QueryTimeOperator::Temporal { .. } => "Temporal",
QueryTimeOperator::Sort { .. } => "Sort",
QueryTimeOperator::HistogramQuantile => "HistogramQuantile",
QueryTimeOperator::Subquery { .. } => "Subquery",
}
}

Expand Down
2 changes: 1 addition & 1 deletion control_plane/src/physical/workload_cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ mod tests {
.store_per_byte_second = store;
let q = &mut snapshot.query_workload.repeating_queries.as_mut().unwrap()[0];
q.query = planner_types::workload::Query(
"max_over_time(a[1m]) + max_over_time(b[1m])".into(),
"sum(max_over_time(a[1m])) + sum(max_over_time(b[1m]))".into(),
);
q.requirements.accuracy = planner_types::workload::AccuracyRequirement::Explicit(
crate::types::AccuracyTarget::Exact,
Expand Down
Loading
Loading