Interface CustomMetric

All Known Implementing Classes:
CustomAvgMetric, CustomSumMetric

@Evolving public interface CustomMetric
A custom metric. Data source can define supported custom metrics using this interface. During query execution, Spark will collect the task metrics using CustomTaskMetric and combine the metrics at the driver side. How to combine task metrics is defined by the metric class with the same metric name. When Spark needs to aggregate task metrics, it will internally construct the instance of custom metric class defined in data source by using reflection. Spark requires the class implementing this interface to have a 0-arg constructor.
Since:
3.2.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    The initial value of this metric.
  • Method Summary

    Modifier and Type
    Method
    Description
    aggregateTaskMetrics(long[] taskMetrics)
    Given an array of task metric values, returns aggregated final metric value.
    Returns the description of custom metric.
    Returns the name of custom metric.
  • Field Details

    • initialValue

      static final long initialValue
      The initial value of this metric.
      See Also:
  • Method Details

    • name

      String name()
      Returns the name of custom metric.
    • description

      String description()
      Returns the description of custom metric.
    • aggregateTaskMetrics

      String aggregateTaskMetrics(long[] taskMetrics)
      Given an array of task metric values, returns aggregated final metric value.