Skip to content
Merged
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
82 changes: 65 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions control_plane/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ asap_types.workspace = true
# this doesn't pull in datafusion or any front-end weight. asap-sketch is
# asap-plan's own dependency (SummaryKind/SummaryParams), needed here only
# to translate Implementation into this repo's own Capability vocabulary.
asap-ir = { git = "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/ProjectASAP/ASAPController", rev = "fc09c3aa0b0cf0297ee415d1ed49f7cdc0cc55e4" }
asap-l2 = { git = "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/ProjectASAP/ASAPController", rev = "fc09c3aa0b0cf0297ee415d1ed49f7cdc0cc55e4" }
asap-sketch = { git = "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/ProjectASAP/ASAPController", rev = "fc09c3aa0b0cf0297ee415d1ed49f7cdc0cc55e4" }
asap-plan = { git = "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/ProjectASAP/ASAPController", rev = "fc09c3aa0b0cf0297ee415d1ed49f7cdc0cc55e4" }
#
# Bumped to 64df20d (main tip, "feat(plan): pluggable AggIntent::Extension
# realization + readout hook", #162) to pick up
# `CostModel::{realize_extension, readout_extension}` -- the pluggable
# `AggIntent::Extension` hook this repo's `Extension{"frequency"}` intent
# needs (ASAPController#150). 64df20d is a strict descendant of d4c1756
# (the previous pin), so nothing this repo already consumes moves.
asap-ir = { git = "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/ProjectASAP/ASAPController", rev = "64df20d90c3ddd519c726dea45c05e1fe5225ce6" }
asap-l2 = { git = "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/ProjectASAP/ASAPController", rev = "64df20d90c3ddd519c726dea45c05e1fe5225ce6" }
asap-sketch = { git = "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/ProjectASAP/ASAPController", rev = "64df20d90c3ddd519c726dea45c05e1fe5225ce6" }
asap-plan = { git = "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/ProjectASAP/ASAPController", rev = "64df20d90c3ddd519c726dea45c05e1fe5225ce6" }

[dev-dependencies]
tokio = { version = "1", features = ["full", "test-util"] }
Expand Down
25 changes: 16 additions & 9 deletions control_plane/src/emit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,10 +1024,13 @@ mod runtime_tests {
Some(BTreeSet::from([SummaryKind::CountSketchWithHeap])),
),
// `CountMinSketch` override re-derives statistic to
// `Frequency`, `AggIntent::Extension`-shaped — declines to
// bind pending ASAPController#150 (see
// `optimizer::rules::tests::typed_binding_endpoint_request_freq_declines_pending_upstream_extension_support`).
("endpoint_request_freq", None),
// `Frequency`, `AggIntent::Extension`-shaped — now binds via
// `ControlPlaneCostModel::realize_extension` (ASAPController#150,
// see `optimizer::rules::tests::typed_binding_endpoint_request_freq_binds_cms`).
(
"endpoint_request_freq",
Some(BTreeSet::from([SummaryKind::Cms])),
),
];
for (metric, want) in &expected {
let got = map.get(*metric).cloned();
Expand All @@ -1037,12 +1040,12 @@ mod runtime_tests {
full map: {map:?}",
);
}
// Routing table covers the 4 sketched metrics (endpoint_request_freq
// and http_requests_total both decline — see above).
// Routing table covers the 5 sketched metrics (only
// http_requests_total declines, as raw passthrough).
assert_eq!(
map.len(),
4,
"routing table should have 4 entries (4 sketches; raw + Extension both decline), got: {map:?}"
5,
"routing table should have 5 entries (5 sketches; only raw passthrough declines), got: {map:?}"
);
}

Expand Down Expand Up @@ -1225,7 +1228,11 @@ mod runtime_tests {
store.set(
METRIC,
AggRole::Other,
mk(AggType::Frequency, Some(SketchType::CountSketch), Vec::new()),
mk(
AggType::Frequency,
Some(SketchType::CountSketch),
Vec::new(),
),
WorkloadCharacteristics::default(),
);

Expand Down
5 changes: 4 additions & 1 deletion control_plane/src/emit/stage_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3038,9 +3038,10 @@ fn build_backend_readout_json(r: &BackendReadout) -> JsonValue {
SketchQuery::Cardinality => json!({
"op": "cardinality",
}),
SketchQuery::PointCount { key } => json!({
SketchQuery::PointCount { key, value } => json!({
"op": "point_count",
"key": column_ref_to_wire_key(key),
"value": value,
}),
SketchQuery::TopK { k } => json!({
"op": "topk",
Expand Down Expand Up @@ -3613,6 +3614,7 @@ mod tests {
aggregation_id: "agg1".into(),
op: SketchQuery::PointCount {
key: ColumnRef::Named("user_42".into()),
value: None,
},
},
],
Expand Down Expand Up @@ -3700,6 +3702,7 @@ mod tests {
SummaryKind::CountSketch => SketchQuery::TopK { k: 10 },
SummaryKind::Cms => SketchQuery::PointCount {
key: ColumnRef::Named("user_42".into()),
value: None,
},
other => unreachable!(
"backend_cfg_with_kind: unsupported test fixture kind {other:?}"
Expand Down
8 changes: 7 additions & 1 deletion control_plane/src/intent_algebra/agg_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ pub use asap_ir::intent_algebra::{
use crate::intent_algebra::schema::{Column, DataType};
use crate::types_v2::AccuracyTarget;

const FREQUENCY_EXT_KIND: &str = "frequency";
/// `ext_kind` tag for control_plane's point-frequency-via-CMS intent.
/// `pub(crate)` (not just module-private) so
/// `sketch_algebra::cost_model::ControlPlaneCostModel`'s
/// `realize_extension`/`readout_extension` can match on it directly --
/// those take `(ext_kind: &str, payload: &serde_json::Value)`, not a
/// whole `AggIntent`, so they can't call [`as_frequency`] itself.
pub(crate) const FREQUENCY_EXT_KIND: &str = "frequency";

/// Construct control_plane's point-frequency-via-CMS intent. See module
/// docs for why this is an `Extension`, not a shared first-class variant.
Expand Down
Loading