This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 657887dca9 Fix custom metric display (#20643)
657887dca9 is described below

commit 657887dca9e60265ba034533793734409c3f5246
Author: Gabriel <[email protected]>
AuthorDate: Tue Mar 3 07:55:00 2026 +0100

    Fix custom metric display (#20643)
    
    ## Which issue does this PR close?
    
    <!--
    We generally require a GitHub issue to be filed for all bug fixes and
    enhancements and this helps us generate change logs for our releases.
    You can link an issue to this PR using the GitHub syntax. For example
    `Closes #123` indicates that this PR will close issue #123.
    -->
    
    - Closes part of
    https://github.com/datafusion-contrib/datafusion-distributed/issues/361.
    
    ## Rationale for this change
    
    <!--
    Why are you proposing this change? If this is already explained clearly
    in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand
    your changes and offer better suggestions for fixes.
    -->
    
    The custom metrics display is unnecessarily prepending the name of the
    metric during the display:
    
    ```
    network_latency_min_2=name:network_latency_min 274.88µs
    ```
    
    When it should just be:
    ```
    network_latency_min_2=274.88µs
    ```
    
    ## What changes are included in this PR?
    
    <!--
    There is no need to duplicate the description in the issue here but it
    is sometimes worth providing a summary of the individual changes in this
    PR.
    -->
    
    Fix to the display
    
    ## Are these changes tested?
    
    <!--
    We typically require tests for all PRs in order to:
    1. Prevent the code from being accidentally broken by subsequent changes
    2. Serve as another way to document the expected behavior of the code
    
    If tests are not included in your PR, please explain why (for example,
    are they covered by existing tests)?
    -->
    
    yes, by a new test
    
    ## Are there any user-facing changes?
    
    <!--
    If there are user-facing changes then we may require documentation to be
    updated before approving the PR.
    -->
    
    <!--
    If there are any breaking changes to public APIs, please add the `api
    change` label.
    -->
---
 datafusion/physical-expr-common/src/metrics/value.rs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/datafusion/physical-expr-common/src/metrics/value.rs 
b/datafusion/physical-expr-common/src/metrics/value.rs
index 26f68980ba..d9e93aa361 100644
--- a/datafusion/physical-expr-common/src/metrics/value.rs
+++ b/datafusion/physical-expr-common/src/metrics/value.rs
@@ -1050,8 +1050,8 @@ impl Display for MetricValue {
                 write!(f, "{pruning_metrics}")
             }
             Self::Ratio { ratio_metrics, .. } => write!(f, "{ratio_metrics}"),
-            Self::Custom { name, value } => {
-                write!(f, "name:{name} {value}")
+            Self::Custom { value, .. } => {
+                write!(f, "{value}")
             }
         }
     }
@@ -1146,6 +1146,12 @@ mod tests {
         }
     }
 
+    #[test]
+    fn test_display_custom_metric() {
+        let custom_val = new_custom_counter("hi", 11);
+        assert_eq!(custom_val.to_string(), "count: 11");
+    }
+
     #[test]
     fn test_display_output_rows() {
         let count = Count::new();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to