vortex_array/aggregate_fn/satisfaction.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4/// Whether a stored aggregate function can satisfy a requested aggregate function.
5#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
6pub enum AggregateFnSatisfaction {
7 /// The stored aggregate cannot satisfy the requested aggregate.
8 #[default]
9 No,
10 /// The stored aggregate can satisfy the request as an approximate bound.
11 Approximate,
12 /// The stored aggregate exactly satisfies the request.
13 Exact,
14}
15
16impl AggregateFnSatisfaction {
17 /// Returns whether the stored aggregate can satisfy the requested aggregate.
18 pub fn is_satisfied(self) -> bool {
19 !matches!(self, Self::No)
20 }
21
22 /// Returns whether the stored aggregate exactly satisfies the requested aggregate.
23 pub fn is_exact(self) -> bool {
24 matches!(self, Self::Exact)
25 }
26}