use crate::db::query::plan::{AccessPlannedQuery, DeterministicSecondaryOrderContract};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(in crate::db) struct LogicalPushdownEligibility {
secondary_order_allowed: bool,
grouped_aggregate_allowed: bool,
requires_full_materialization: bool,
}
impl LogicalPushdownEligibility {
#[must_use]
pub(in crate::db) const fn new(
secondary_order_allowed: bool,
grouped_aggregate_allowed: bool,
requires_full_materialization: bool,
) -> Self {
Self {
secondary_order_allowed,
grouped_aggregate_allowed,
requires_full_materialization,
}
}
#[must_use]
pub(in crate::db) const fn secondary_order_allowed(self) -> bool {
self.secondary_order_allowed
}
#[must_use]
pub(in crate::db) const fn grouped_aggregate_allowed(self) -> bool {
self.grouped_aggregate_allowed
}
#[must_use]
pub(in crate::db) const fn requires_full_materialization(self) -> bool {
self.requires_full_materialization
}
}
#[must_use]
pub(in crate::db) const fn derive_logical_pushdown_eligibility(
plan: &AccessPlannedQuery,
secondary_order_contract: Option<&DeterministicSecondaryOrderContract>,
) -> LogicalPushdownEligibility {
LogicalPushdownEligibility::new(
secondary_order_contract.is_some(),
plan.grouped_plan().is_some(),
false,
)
}