sfluor commented on code in PR #16195: URL: https://github.com/apache/datafusion/pull/16195#discussion_r2110945415
########## datafusion/physical-plan/src/metrics/value.rs: ########## @@ -443,6 +460,9 @@ impl MetricValue { .and_then(|ts| ts.timestamp_nanos_opt()) .map(|nanos| nanos as usize) .unwrap_or(0), + Self::Custom { name, value } => { + panic!("MetricValue::as_usize isn't supported for custom metric values. ({name}: {value:?})") + } Review Comment: Added the possibility to implement it with a default that still throws 👍 ########## datafusion/physical-plan/src/metrics/value.rs: ########## @@ -401,6 +401,22 @@ pub enum MetricValue { StartTimestamp(Timestamp), /// The time at which execution ended EndTimestamp(Timestamp), + Custom { + /// The provided name of this metric + name: Cow<'static, str>, + /// A custom implementation of the metric value. + value: Arc<dyn CustomMetricValue>, + }, +} + +/// A custom metric value implementation. +/// The only constraint is that it should be aggregatable. +pub trait CustomMetricValue: Display + Debug + Send + Sync { Review Comment: 👍 Updated the docs -- 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