Skip to content

Commit

Permalink
Add column statistics min
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Nov 7, 2024
1 parent 3cc8d8a commit f11ecc5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions datafusion/common/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Precision<T> {
/// Otherwise, it returns `None`.
pub fn get_value(&self) -> Option<&T> {
match self {
Precision::Exact(value) | Precision::Inexact(value) | Precision::AtLeast(value) | Precision::AtMost(T) => Some(value),
Precision::Exact(value)
| Precision::Inexact(value)
| Precision::AtLeast(value)
| Precision::AtMost(T) => Some(value),
Precision::Absent => None,
}
}
Expand Down Expand Up @@ -84,7 +87,6 @@ impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Precision<T> {
}
}


/// Transform the value in this [`Precision`] object, if one exists, using
/// the given function. Preserves the exactness state.
pub fn map<U, F>(self, f: F) -> Precision<U>
Expand Down Expand Up @@ -143,7 +145,6 @@ impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Precision<T> {
}
}


/// Demotes the precision state from exact to inexact (if present).
pub fn to_inexact(self) -> Self {
match self {
Expand Down Expand Up @@ -502,6 +503,16 @@ impl ColumnStatistics {
}
}

/// return the minimum value this column can have, if known
pub fn min_value(&self) -> Option<&ScalarValue> {
self.min_value.get_value()
}

/// return the maximum value this column can have, if known
pub fn max_value(&self) -> Option<&ScalarValue> {
self.max_value.get_value()
}

/// If the exactness of a [`ColumnStatistics`] instance is lost, this
/// function relaxes the exactness of all information by converting them
/// [`Precision::Inexact`].
Expand Down

0 comments on commit f11ecc5

Please sign in to comment.