pub struct Observation {
pub template_hash: String,
pub plan_fingerprint: String,
pub est_rows: u64,
pub actual_rows: u64,
pub latency_ms: Option<f64>,
}Expand description
A single observation captured at query end.
Fields§
§template_hash: String§plan_fingerprint: String§est_rows: u64§actual_rows: u64§latency_ms: Option<f64>Implementations§
Source§impl Observation
impl Observation
Sourcepub fn q_error(&self) -> f64
pub fn q_error(&self) -> f64
Multiplicative q-error: max(actual/est, est/actual). Returns f64::INFINITY if either is 0.
§Examples
use samkhya_core::feedback::Observation;
// 10× underestimate: est=10, actual=100 → q-error = 10.
let obs = Observation {
template_hash: "t".into(),
plan_fingerprint: "p".into(),
est_rows: 10,
actual_rows: 100,
latency_ms: None,
};
assert!((obs.q_error() - 10.0).abs() < 1e-9);Trait Implementations§
Source§impl Clone for Observation
impl Clone for Observation
Source§fn clone(&self) -> Observation
fn clone(&self) -> Observation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Observation
impl Debug for Observation
Source§impl<'de> Deserialize<'de> for Observation
impl<'de> Deserialize<'de> for Observation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Observation
impl PartialEq for Observation
Source§fn eq(&self, other: &Observation) -> bool
fn eq(&self, other: &Observation) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Observation
impl Serialize for Observation
impl StructuralPartialEq for Observation
Auto Trait Implementations§
impl Freeze for Observation
impl RefUnwindSafe for Observation
impl Send for Observation
impl Sync for Observation
impl Unpin for Observation
impl UnsafeUnpin for Observation
impl UnwindSafe for Observation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more