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
60 changes: 12 additions & 48 deletions system-bench/capabilities/victoriametrics.with-substitutes.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
{
"supported_summaries": [
{
"summary_type": "Hll",
"readouts": [
"Distinct"
]
},
{
"summary_type": "Kmv",
"readouts": [
"Distinct"
]
},
{
"summary_type": "Kll",
"readouts": [
"Quantile"
]
},
{
"summary_type": "DDSketch",
"readouts": [
"Quantile"
]
},
{
"summary_type": "CmsWithHeap",
"readouts": [
"TopK"
]
},
{
"summary_type": "CountSketchWithHeap",
"readouts": [
"TopK"
]
}
],
"supported_summaries": [],
"raw_data_retained": true,
"query_time_results_retained": false,
"counter_semantics": {
Expand All @@ -45,20 +8,21 @@
},
"state_not_mergeable_across_windows": [
{
"exact": "IRate"
},
{
"sketch": "Hll"
"exact": "Rate"
},
{
"sketch": "Kmv"
},
"exact": "Increase"
}
],
"excluded_candidates": [
{
"sketch": "CmsWithHeap"
"summary_family": {
"exact": "IRate"
}
},
{
"sketch": "CountSketchWithHeap"
"operator": "Aggregate",
"aggregate_measure": "i_rate"
}
],
"excluded_candidates": []
]
}
17 changes: 1 addition & 16 deletions system-bench/src/engines_external/clickhouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub fn translate(plan: &PlanFile) -> Result<ClickHouseDeployment, TranslationErr
query_time_steps_ms,
table_retention,
substitutions,
sharing_lost: sharing_lost(plan),
sharing_lost: SharingLost::of_plan(plan),
})
}

Expand Down Expand Up @@ -502,21 +502,6 @@ fn label_type(label: &str) -> &'static str {
}
}

/// Query-time nodes two or more readers share.
fn sharing_lost(plan: &PlanFile) -> Vec<SharingLost> {
plan.nodes
.iter()
.filter(|node| node.timing == Timing::QueryTime)
.filter_map(|node| {
let readers = plan.readers_of(node.id);
(readers.len() >= 2).then_some(SharingLost {
node: node.id,
readers,
})
})
.collect()
}

/// A query relation: SQL whose result has the label columns, then `value`.
struct Relation {
sql: String,
Expand Down
25 changes: 24 additions & 1 deletion system-bench/src/engines_external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
//!
//! [`plan_file`] reads an ASAPPlanner plan file (`InstallablePlan`, wire
//! version 15). [`clickhouse`] translates it into ClickHouse tables,
//! materialized views and one SQL query per query root. A translator is the
//! materialized views and one SQL query per query root;
//! [`victoriametrics`] into VictoriaMetrics stream aggregation and one
//! MetricsQL query per query root. A translator is the
//! capability check: a node it has no rule for is refused with
//! [`TranslationError::UnsupportedShape`], and a rule that changes the
//! planner's guarantee is recorded as a [`Substitution`].
Expand All @@ -12,6 +14,9 @@

pub mod clickhouse;
pub mod plan_file;
pub mod victoriametrics;

use plan_file::{PlanFile, Timing};

/// A node's position in the plan file's DAG.
pub type NodeId = usize;
Expand Down Expand Up @@ -47,3 +52,21 @@ pub struct SharingLost {
pub node: NodeId,
pub readers: Vec<NodeId>,
}

impl SharingLost {
/// The query-time nodes of `plan` that two or more readers share, e.g.
/// node 1 (a raw-sample range) read by three quantile nodes.
pub fn of_plan(plan: &PlanFile) -> Vec<SharingLost> {
plan.nodes
.iter()
.filter(|node| node.timing == Timing::QueryTime)
.filter_map(|node| {
let readers = plan.readers_of(node.id);
(readers.len() >= 2).then_some(SharingLost {
node: node.id,
readers,
})
})
.collect()
}
}
Loading
Loading