From 0eafb15de98a19de9f204836056c7812f786df81 Mon Sep 17 00:00:00 2001 From: devanbenz Date: Sat, 6 Jun 2026 12:30:08 -0500 Subject: [PATCH 1/2] feat: Add From> trait for Precision enum --- datafusion/common/src/stats.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/datafusion/common/src/stats.rs b/datafusion/common/src/stats.rs index 320fd43751025..8a8417ae60db0 100644 --- a/datafusion/common/src/stats.rs +++ b/datafusion/common/src/stats.rs @@ -318,6 +318,15 @@ impl Precision { } } +impl From> for Precision { + fn from(option: Option) -> Self { + match option { + Some(value) => Precision::Exact(value), + None => Precision::Absent, + } + } +} + impl Debug for Precision { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { From 15da48661d194c0ae017d6f82dbfa3d82cd149c6 Mon Sep 17 00:00:00 2001 From: devanbenz Date: Tue, 9 Jun 2026 10:12:16 -0500 Subject: [PATCH 2/2] feat: Use map_or --- datafusion/common/src/stats.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/datafusion/common/src/stats.rs b/datafusion/common/src/stats.rs index 8a8417ae60db0..a64d5e00ee6df 100644 --- a/datafusion/common/src/stats.rs +++ b/datafusion/common/src/stats.rs @@ -320,10 +320,7 @@ impl Precision { impl From> for Precision { fn from(option: Option) -> Self { - match option { - Some(value) => Precision::Exact(value), - None => Precision::Absent, - } + option.map_or(Precision::Absent, Precision::Exact) } }