use crate::db::{
query::{builder::AggregateExpr, plan::expr::Expr},
sql::lowering::SqlLoweringError,
};
pub(in crate::db::sql::lowering::aggregate) const fn reject_distinct_filter_pairing(
distinct: bool,
filter_expr: Option<&Expr>,
) -> Result<(), SqlLoweringError> {
if distinct && filter_expr.is_some() {
return Err(SqlLoweringError::unsupported_select_projection());
}
Ok(())
}
#[must_use]
pub(in crate::db::sql::lowering::aggregate) const fn apply_distinct_marker(
aggregate: AggregateExpr,
distinct: bool,
) -> AggregateExpr {
if distinct {
aggregate.distinct()
} else {
aggregate
}
}