pub enum Class {
Exact,
Certified {
bound: f64,
direction: Direction,
},
Estimated,
}Expand description
How much of an answer is knowledge.
Three cases, ordered by how much they permit. Exact permits anything, including changing an
answer by folding a predicate away. Certified permits a decision whose fallback survives being
wrong, which is the case a safe bound is for. Estimated permits choosing between two plans that
produce the same rows, and nothing else.
Variants§
Exact
The value is the value. A count that was counted, a null count that was maintained, a minimum that was compared.
Certified
The value is wrong by no more than bound, as a fraction of itself, in the direction
direction says, and the structure that produced it can prove that.
A quantile summary with an epsilon is the usual source. The number is what makes a threshold
safe to seed from, so a producer that cannot state one should say Estimated instead of
picking a bound that sounds about right.
Fields
Estimated
The value is a guess. Where it came from is the provenance beside it.
Implementations§
Source§impl Class
impl Class
Sourcepub const fn is_exact(self) -> bool
pub const fn is_exact(self) -> bool
Whether this is knowledge rather than a guess, which is the test the folding rule applies.
Sourcepub fn combine(self, other: Self) -> Self
pub fn combine(self, other: Self) -> Self
The class of an answer computed from two others.
Exact combined with anything else is the anything else, which is the honest direction and the
easy one to get backwards. Two certified bounds add, because a combination of two bounded
errors is bounded by their sum, and the sum saturates at one because a bound of more than a
hundred percent says nothing that Estimated does not say. Two certificates that bound
opposite sides combine to Direction::Within, because that is all that is still provable about
the pair. Anything involving an estimate is an estimate.