You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/06/10 02:52:50 UTC
(datafusion) 01/01: feat: Add From
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-22792-40a64546c8ed25a00c8100d2fb4f44890e22fc25
in repository https://gitbox.apache.org/repos/asf/datafusion.git
commit d77a02d662b27852cc247153d9edcad5a92905d4
Author: WeblWabl <de...@gmail.com>
AuthorDate: Tue Jun 9 21:52:27 2026 -0500
feat: Add From<Option<T>> trait for Precision enum (#22792)
This commit adds a `From<Option<T>>` trait for `Precision`. Porting from
`influxdb` to upstream:
https://github.com/influxdata/influxdb/blob/70335b158808881c2f5a9ef27cd4bcbe4944686a/core/datafusion_util/src/lib.rs#L153-L163
---
datafusion/common/src/stats.rs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/datafusion/common/src/stats.rs b/datafusion/common/src/stats.rs
index 320fd43751..a64d5e00ee 100644
--- a/datafusion/common/src/stats.rs
+++ b/datafusion/common/src/stats.rs
@@ -318,6 +318,12 @@ impl Precision<ScalarValue> {
}
}
+impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> From<Option<T>> for Precision<T> {
+ fn from(option: Option<T>) -> Self {
+ option.map_or(Precision::Absent, Precision::Exact)
+ }
+}
+
impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Debug for Precision<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org