Skip to content
Open
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
1 change: 1 addition & 0 deletions crates/asap-aware-mapping/src/accuracy/composition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ mod tests {
measures: vec![intent],
output_names: vec![],
having: None,
filters: vec![],
};
assert_eq!(
DefaultAccuracyModel.exact_operation_rule(&operation(AggIntent::Rate)),
Expand Down
8 changes: 7 additions & 1 deletion crates/asap-aware-mapping/src/accuracy/reconciliation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ use std::cmp::Ordering;
use std::rc::Rc;

use asap_types::pre_asap::agg_intent::AggIntent;
use asap_types::pre_asap::query_expr::{QueryExpr, Reduction};
use asap_types::pre_asap::query_expr::{any_measure_filtered, QueryExpr, Reduction};
use asap_types::types::AccuracyTarget;

use crate::replacement::{
Expand Down Expand Up @@ -186,6 +186,7 @@ fn bindable_accuracy_aggregate(node: &QueryExpr) -> Option<BindableAccuracyAggre
reduction,
measures,
output_names,
filters,
having,
child,
} = node
Expand All @@ -195,6 +196,9 @@ fn bindable_accuracy_aggregate(node: &QueryExpr) -> Option<BindableAccuracyAggre
let ([intent], None) = (measures.as_slice(), having) else {
return None;
};
if any_measure_filtered(filters) {
return None;
}
let accuracy = accuracy_target(intent)?;
Some((reduction, intent, accuracy, output_names.as_slice(), child))
}
Expand Down Expand Up @@ -418,6 +422,7 @@ mod tests {
reduction: Reduction::by(by),
measures: vec![intent],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::clone(child),
})
Expand Down Expand Up @@ -468,6 +473,7 @@ mod tests {
accuracy,
}],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::clone(child),
})
Expand Down
2 changes: 2 additions & 0 deletions crates/asap-aware-mapping/src/cost_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,7 @@ mod tests {
measures: vec![AggIntent::Max { col: None }],
output_names: vec![],
having: None,
filters: vec![],
},
OperationPlacement::Read,
),
Expand Down Expand Up @@ -1377,6 +1378,7 @@ mod tests {
),
reduction: asap_types::pre_asap::query_expr::Reduction::by(vec![]),
grouping: GroupingStrategy::default(),
filter: None,
},
schema: SummarySchema {
fields: vec![SummaryField {
Expand Down
14 changes: 13 additions & 1 deletion crates/asap-aware-mapping/src/exact_composition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use asap_types::post_asap::{
SummarySchema, ValueOperation,
};
use asap_types::pre_asap::agg_intent::AggIntent;
use asap_types::pre_asap::query_expr::{QueryExpr, Reduction};
use asap_types::pre_asap::query_expr::{any_measure_filtered, QueryExpr, Reduction};
use asap_types::types::AccuracyTarget;

use crate::cost_model::CostModel;
Expand Down Expand Up @@ -266,12 +266,16 @@ fn query_time_shape(
reduction,
measures,
output_names,
filters,
having: None,
child,
} = root
else {
return None;
};
if any_measure_filtered(filters) {
return None;
}
let Reduction::Reduce(by) = reduction else {
return None;
};
Expand Down Expand Up @@ -299,6 +303,7 @@ fn query_time_shape(
reduction: reduction.clone(),
measures: measures.clone(),
output_names: output_names.clone(),
filters: filters.clone(),
having: None,
},
Rc::clone(child),
Expand All @@ -316,12 +321,16 @@ fn ingestion_time_shape(
reduction: Reduction::PerEntity,
measures,
output_names,
filters,
having: None,
child,
} = root
else {
return None;
};
if any_measure_filtered(filters) {
return None;
}
let [intent] = measures.as_slice() else {
return None;
};
Expand All @@ -343,6 +352,7 @@ fn ingestion_time_shape(
reduction: Reduction::PerEntity,
measures: measures.clone(),
output_names: output_names.clone(),
filters: filters.clone(),
having: None,
},
Rc::clone(child),
Expand Down Expand Up @@ -479,6 +489,7 @@ mod tests {
reduction: Reduction::by(by),
measures: vec![intent],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::new(child),
}
Expand All @@ -489,6 +500,7 @@ mod tests {
reduction: Reduction::PerEntity,
measures: vec![intent],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::new(child),
}
Expand Down
1 change: 1 addition & 0 deletions crates/asap-aware-mapping/src/explanation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ mod tests {
reduction: Reduction::by(by),
measures: vec![intent],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::new(child),
}
Expand Down
4 changes: 4 additions & 0 deletions crates/asap-aware-mapping/src/grouping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ fn with_grouping(
input: input.clone(),
reduction: reduction.clone(),
grouping,
filter: None,
},
schema: grouped_schema,
guarantee: None,
Expand Down Expand Up @@ -515,6 +516,7 @@ mod tests {
reduction: Reduction::by(by),
measures: vec![intent],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::new(child),
}
Expand All @@ -525,6 +527,7 @@ mod tests {
reduction: Reduction::PerEntity,
measures: vec![intent],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::new(child),
}
Expand Down Expand Up @@ -840,6 +843,7 @@ mod tests {
reduction: Reduction::by(vec![2]),
measures: vec![AggIntent::Sum { col: None }, AggIntent::Avg { col: None }],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::new(metric_scan(&["job"])),
});
Expand Down
7 changes: 6 additions & 1 deletion crates/asap-aware-mapping/src/maintained_population.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use asap_types::post_asap::{
SummaryField, SummaryNode, SummarySchema, ValueOperation,
};
use asap_types::pre_asap::{
AggIntent, CompareOpKind, DataType, QueryExpr, Reduction, ScalarValue, Schema, Source,
any_measure_filtered, AggIntent, CompareOpKind, DataType, QueryExpr, Reduction, ScalarValue,
Schema, Source,
};
use std::rc::Rc;

Expand Down Expand Up @@ -40,12 +41,16 @@ fn recognize(root: &QueryExpr) -> Option<(MaintainedPopulation, PopulationReadou
child,
reduction: Reduction::Reduce(grouping),
measures,
filters,
having: None,
..
} => {
let [intent] = measures.as_slice() else {
return None;
};
if any_measure_filtered(filters) {
return None;
}
let (col, readout) = match intent {
AggIntent::Quantile { q, col, .. } if q.is_finite() => {
(*col, PopulationReadout::Quantile { q: *q })
Expand Down
1 change: 1 addition & 0 deletions crates/asap-aware-mapping/src/physical_plan_cost_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ mod tests {
accuracy: AccuracyTarget::Epsilon(0.01),
}],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::new(QueryExpr::Scan {
source: Source::Table {
Expand Down
11 changes: 10 additions & 1 deletion crates/asap-aware-mapping/src/query_physical_lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,15 @@ pub fn lower_query_physical_dag(
QueryExpr::Aggregate {
reduction,
measures,
filters,
having,
child,
..
} => {
if having.is_some() || measures.is_empty() {
if having.is_some()
|| asap_types::pre_asap::any_measure_filtered(filters)
|| measures.is_empty()
{
return Err(AnalyticalCostError::UnsupportedQueryOperator);
}
if matches!(reduction, asap_types::pre_asap::Reduction::PerEntity) {
Expand Down Expand Up @@ -1457,6 +1461,7 @@ mod tests {
reduction: Reduction::by(vec![]),
measures: vec![AggIntent::PearsonCorr { left: 0, right: 1 }],
output_names: vec!["r".into()],
filters: vec![],
having: None,
child: Rc::new(QueryExpr::Scan {
source: source.clone(),
Expand Down Expand Up @@ -1516,6 +1521,7 @@ mod tests {
reduction: Reduction::by(vec![0]),
measures: vec![AggIntent::Sum { col: Some(1) }],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::clone(&scan),
});
Expand Down Expand Up @@ -2251,6 +2257,7 @@ mod tests {
accuracy: AccuracyTarget::Exact,
}],
output_names: vec![],
filters: vec![],
having: None,
child: scan(),
});
Expand Down Expand Up @@ -2331,6 +2338,7 @@ mod tests {
reduction: Reduction::PerEntity,
measures: vec![AggIntent::Absent],
output_names: vec![],
filters: vec![],
having: None,
child: scan,
});
Expand Down Expand Up @@ -2566,6 +2574,7 @@ mod tests {
reduction: Reduction::PerEntity,
measures: vec![AggIntent::Sum { col: None }],
output_names: vec![],
filters: vec![],
having: None,
child: sample,
});
Expand Down
3 changes: 3 additions & 0 deletions crates/asap-aware-mapping/src/recurrence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ mod tests {
)),
reduction: Reduction::by(vec![]),
grouping: GroupingStrategy::default(),
filter: None,
},
schema: SummarySchema {
fields: vec![SummaryField {
Expand Down Expand Up @@ -1162,6 +1163,7 @@ mod tests {
reduction: QueryReduction::by(vec![2]),
measures: vec![AggIntent::Sum { col: Some(1) }],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::new(labeled_scan()),
}
Expand Down Expand Up @@ -1385,6 +1387,7 @@ mod tests {
reduction: QueryReduction::by(vec![]),
measures: vec![AggIntent::Avg { col: None }],
output_names: vec![],
filters: vec![],
having: None,
child: Rc::new(scan()),
};
Expand Down
Loading
Loading