1#![deny(missing_docs)]
6use std::fmt::Debug;
7
8use datafusion_common::stats::Precision as DFPrecision;
9use vortex::stats::Precision;
10
11mod convert;
12mod persistent;
13
14pub use persistent::*;
15
16trait PrecisionExt<T>
18where
19 T: Debug + Clone + PartialEq + Eq + PartialOrd,
20{
21 fn to_df(self) -> DFPrecision<T>;
23}
24
25impl<T> PrecisionExt<T> for Precision<T>
26where
27 T: Debug + Clone + PartialEq + Eq + PartialOrd,
28{
29 fn to_df(self) -> DFPrecision<T> {
30 match self {
31 Precision::Exact(v) => DFPrecision::Exact(v),
32 Precision::Inexact(v) => DFPrecision::Inexact(v),
33 }
34 }
35}
36
37impl<T> PrecisionExt<T> for Option<Precision<T>>
38where
39 T: Debug + Clone + PartialEq + Eq + PartialOrd,
40{
41 fn to_df(self) -> DFPrecision<T> {
42 match self {
43 Some(v) => v.to_df(),
44 None => DFPrecision::Absent,
45 }
46 }
47}