LiaCastaneda commented on code in PR #16195:
URL: https://github.com/apache/datafusion/pull/16195#discussion_r2126024222


##########
datafusion/physical-plan/src/metrics/value.rs:
##########
@@ -443,6 +528,9 @@ impl MetricValue {
                 .and_then(|ts| ts.timestamp_nanos_opt())
                 .map(|nanos| nanos as usize)
                 .unwrap_or(0),
+            Self::Custom { name, value } => {
+                value.as_usize().unwrap_or_else(|| 
panic!("MetricValue::as_usize isn't supported for custom metric values. 
({name}: {value:?})"))

Review Comment:
   why not use `.unwrap_or(0)` ?
   edit: I guess its unconventional given that `StartTimestamp` & 
`EndTimestamp` the defaults to 0



##########
datafusion/physical-plan/src/metrics/value.rs:
##########
@@ -443,6 +528,9 @@ impl MetricValue {
                 .and_then(|ts| ts.timestamp_nanos_opt())
                 .map(|nanos| nanos as usize)
                 .unwrap_or(0),
+            Self::Custom { name, value } => {
+                value.as_usize().unwrap_or_else(|| 
panic!("MetricValue::as_usize isn't supported for custom metric values. 
({name}: {value:?})"))

Review Comment:
   why not use `.unwrap_or(0)` ?
   edit: I guess its unconventional given that `StartTimestamp` & 
`EndTimestamp` defaults to 0



-- 
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-unsubscr...@datafusion.apache.org

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


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

Reply via email to