Skip to content

Commit f574c00

Browse files
zzylolclaude
andcommitted
fix(physical): keep raw unit-frequency updates to unkeyed sketches
State the canonical label-set obligation and assert per-query coverage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c5bc826 commit f574c00

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎crates/asap-physical-operators/src/physical_planner/precompute.rs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ pub fn population_schema(family: SummaryFamilyType) -> Schema {
3939
/// complete label set, so it is the complete source identity of per-series
4040
/// summaries; `$timestamp` is the sample time and `value` a finite sample
4141
/// (stale markers are not samples). Rows are what the boundary's source scan
42-
/// selected; the deployment decides which rows and panes they are. Build rows
43-
/// with [`raw_sample_row`], which makes the label set canonical.
42+
/// selected; the deployment decides which rows and panes they are. Label sets
43+
/// must be canonical (sorted, unique, no empty values), since they are the
44+
/// population identity: build rows with [`raw_sample_row`].
4445
pub fn raw_sample_schema() -> Schema {
4546
let mut schema = (*population_schema(SummaryFamilyType::Plain(DataType::Float64))).clone();
4647
schema.fields[1].name = "$timestamp".into();
@@ -374,7 +375,7 @@ fn fragment(
374375
// A unit-frequency summary (HLL) observes each raw sample value.
375376
let unit_frequency = raw
376377
&& crate::capability::is_unit_sample_frequency(update)
377-
&& !matches!(family, SummaryFamilyType::Sketch(kind, _) if matches!(
378+
&& matches!(family, SummaryFamilyType::Sketch(kind, _) if !matches!(
378379
kind.algorithm(),
379380
planner_types::post_asap::SketchAlgorithm::Cms
380381
| planner_types::post_asap::SketchAlgorithm::CountSketch

‎crates/integration-tests/tests/precompute_raw_samples.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,16 @@ fn raw_sample_summaries_compile_and_match_their_kernels() {
420420
}
421421
}
422422
println!("checked {checked:?}; families {families:?}; without native state {unsupported:?}");
423+
for query in [
424+
"topk by (service) (2, sum_over_time(m[5m]))",
425+
"quantile by (service) (0.9, m)",
426+
"distinct_over_time(m[5m])",
427+
] {
428+
assert!(
429+
checked.contains_key(query),
430+
"{query} has no checked raw summary"
431+
);
432+
}
423433
for family in [
424434
"Sum",
425435
"Count",

0 commit comments

Comments
 (0)