You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "devanbenz (via GitHub)" <gi...@apache.org> on 2026/06/06 17:50:56 UTC

[PR] feat: Add From> trait for Precision enum [datafusion]

devanbenz opened a new pull request, #22792:
URL: https://github.com/apache/datafusion/pull/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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: Add From> trait for Precision enum [datafusion]

Posted by "kosiew (via GitHub)" <gi...@apache.org>.
kosiew commented on code in PR #22792:
URL: https://github.com/apache/datafusion/pull/22792#discussion_r3377138492


##########
datafusion/common/src/stats.rs:
##########
@@ -318,6 +318,15 @@ impl Precision<ScalarValue> {
     }
 }
 
+impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> From<Option<T>> for Precision<T> {
+    fn from(option: Option<T>) -> Self {

Review Comment:
   Small readability suggestion: this `Option` match can be collapsed without changing behavior. This keeps the mapping from `Some` to `Exact` and `None` to `Absent` pretty direct:
   
   ```rust
   option.map_or(Precision::Absent, Precision::Exact)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: Add From> trait for Precision enum [datafusion]

Posted by "kosiew (via GitHub)" <gi...@apache.org>.
kosiew merged PR #22792:
URL: https://github.com/apache/datafusion/pull/22792


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: Add From> trait for Precision enum [datafusion]

Posted by "devanbenz (via GitHub)" <gi...@apache.org>.
devanbenz commented on code in PR #22792:
URL: https://github.com/apache/datafusion/pull/22792#discussion_r3382305852


##########
datafusion/common/src/stats.rs:
##########
@@ -318,6 +318,15 @@ impl Precision<ScalarValue> {
     }
 }
 
+impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> From<Option<T>> for Precision<T> {
+    fn from(option: Option<T>) -> Self {

Review Comment:
   Sounds good, made the changes. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org