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
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ impl SQLQuery {
pub fn is_valid(&self) -> bool {
self.error.is_none()
}

/// The outer (spatial / single) query's data — always `query_data[0]`.
pub fn outer_data(&self) -> Option<&SQLQueryData> {
self.query_data.first()
}

/// The inner (temporal) query's data for nested queries — always `query_data[1]`.
/// Only valid for `OneTemporalOneSpatial` patterns.
pub fn inner_data(&self) -> Option<&SQLQueryData> {
self.query_data.get(1)
}
}

pub struct SQLPatternMatcher {
Expand Down
14 changes: 14 additions & 0 deletions asap-query-engine/src/data_model/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ pub trait AggregateCore: SerializableToSink + Send + Sync {

/// Get all keys stored in this accumulator
fn get_keys(&self) -> Option<Vec<KeyByLabelValues>>;

/// Dispatch a statistic query without downcasting.
///
/// Replaces the 12-arm `match get_accumulator_type()` in the engine.
/// Single-subpopulation types ignore `key`; multiple-subpopulation types
/// require it and return `Err` when it is `None`.
/// Special cases (DeltaSetAggregator, SetAggregator) fall back to a
/// cardinality value when `key` is `None`.
fn query_statistic(
&self,
statistic: Statistic,
key: &Option<KeyByLabelValues>,
query_kwargs: &HashMap<String, String>,
) -> Result<f64, Box<dyn std::error::Error + Send + Sync>>;
}

/// Trait for accumulators that support a single subpopulation
Expand Down
Loading
Loading