pub enum Class {
Exact,
Certified {
bound: f64,
},
Estimated {
source: Source,
},
}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, 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.
Estimated
The value is a guess, and this is where it came from.
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. Anything involving an estimate is
an estimate, and the source of a combination is Source::Propagation unless one of the two
was a bare constant, in which case the answer is as weak as the constant was.