-
Notifications
You must be signed in to change notification settings - Fork 0
Exact TopK (accuracy: Exact) has no warm-tier materialization -- always falls to archive #432
Copy link
Copy link
Open
Labels
area: control planePlanning, configuration, routing, and control-plane orchestrationPlanning, configuration, routing, and control-plane orchestrationarea: data planeRuntime ingestion, storage, and query-serving data pathsRuntime ingestion, storage, and query-serving data pathsarea: query enginePromQL lowering, execution, result shaping, and fallback behaviorPromQL lowering, execution, result shaping, and fallback behaviorarea: summary executionWarm-summary binding, readout, composition, and result decodingWarm-summary binding, readout, composition, and result decodingenhancementNew feature or requestNew feature or requestfeature: PromQLPromQL compatibility and execution semanticsPromQL compatibility and execution semanticsfeature: Top-KTop-K planning, heap materialization, ranking, and labelsTop-K planning, heap materialization, ranking, and labelsfeature: sketch algorithmsSketch-family configuration, lifecycle, merge, and readout behaviorSketch-family configuration, lifecycle, merge, and readout behaviorfeature: warm summariesASAP warm-tier materialization, readiness, and servingASAP warm-tier materialization, readiness, and servingquality: accuracyExact and approximate accuracy contracts, error bounds, and routingExact and approximate accuracy contracts, error bounds, and routing
Description
Activity
Metadata
Metadata
Assignees
Labels
area: control planePlanning, configuration, routing, and control-plane orchestrationPlanning, configuration, routing, and control-plane orchestrationarea: data planeRuntime ingestion, storage, and query-serving data pathsRuntime ingestion, storage, and query-serving data pathsarea: query enginePromQL lowering, execution, result shaping, and fallback behaviorPromQL lowering, execution, result shaping, and fallback behaviorarea: summary executionWarm-summary binding, readout, composition, and result decodingWarm-summary binding, readout, composition, and result decodingenhancementNew feature or requestNew feature or requestfeature: PromQLPromQL compatibility and execution semanticsPromQL compatibility and execution semanticsfeature: Top-KTop-K planning, heap materialization, ranking, and labelsTop-K planning, heap materialization, ranking, and labelsfeature: sketch algorithmsSketch-family configuration, lifecycle, merge, and readout behaviorSketch-family configuration, lifecycle, merge, and readout behaviorfeature: warm summariesASAP warm-tier materialization, readiness, and servingASAP warm-tier materialization, readiness, and servingquality: accuracyExact and approximate accuracy contracts, error bounds, and routingExact and approximate accuracy contracts, error bounds, and routing
Context
One of the five "D1-D5" query-shape gaps originally tracked in the (now-retired)
analyzer-parity-matrix.md, and explicitly scoped incontrol_plane/docs/design-backend-plan-wire-format.md/migration-plan-backend-plan.md(#389/#390, Phase 3) as somethingcapability_for()should close. Confirmed still open today:topk(k, metric)(or any composed shape reducing toAggIntent::TopK { accuracy: Exact, .. }) always capability-misses to archive today — there is no warm-tier path, approximate or exact.Root cause (two layers)
capability_for()delegates directly toasap_plan::boundary::implementation_for(intent)for everything except the localFrequencyextension. ForTopK { accuracy: Exact },implementation_for'sexact_realizationreturnsImplementation::PassThroughunconditionally — no accumulator form forTopKexists inasap-planat all, and (perimplementation_for_with's design) the decision to even try isn't reachable via aCostModelhook. This is already tracked as ASAPController#151 — filed before this repo's git-dep migration, still open.TopKatExactstarts offering a candidate list toCostModelinstead of hard-PassThrough),data_planehas no concept of an exact, warm-tier top-k materialization to realize it as.AggregationType(ExactAgg's family enum) only hasSum/MinMax/Increase— noTopKvariant — and there's no accumulator inprecompute_engine/operators/implementing "exact heap-based top-k" (theHashAgg+Heapthe test comment names).capability_for's exact-accumulator branch (implementation_to_capability) has nowhere to map a hypotheticalSummaryKind::TopK-exact even if upstream started producing one.So this needs work on both sides, not just a local fix once #151 lands.
What closing this would take
TopK-at-Exactas a real candidate toCostModel, or an equivalent mechanism).AggregationTypevariant (or equivalent) representing exact top-k, plus a real accumulator (a bounded min-heap over exact per-key counts — the "HashAgg+Heap" the existing test comment already names as the target shape).capability_for'simplementation_to_capabilityextended to map it.AggregationConfig/StreamingConfigschema would need a materialization shape for it (same underlying gapdesign-backend-plan-wire-format.md's still-unimplementedMaterializationPayload::ExactAggregatewas meant to cover generally — this is one concrete instance of that broader, still-unstartedBackendPlanwork, not a reason to block on it specifically).Scope note
Not urgent on its own —
topk(...)at approximate accuracy already works viaFrequencyTopk/CMS-with-heap; this only affects theaccuracy: Exactrequest explicitly asking for no approximation, which today correctly (if unhelpfully) falls over to archive rather than silently returning an approximate answer. Filing to keep it visible alongside the other D1-D5 items now thatanalyzer-parity-matrix.md(which used to track it) is retired.References
control_plane/src/sketch_algebra/capability.rs—capability_for/implementation_to_capability,capability_for_topk_exact_returns_nonecontrol_plane/docs/design-backend-plan-wire-format.md§7 ("Closing D1-D5") /migration-plan-backend-plan.mdPhase 3 — original scoping of this exact gap, from beforeanalyzer-parity-matrix.mdwas retired