code: def compute_metrics_pyspark(df, metric, total):
      """Compute the metric value for a given pyspark DataFrame.
  
      :param df: The DataFrame to compute the metric on.
      :type df: pyspark.sql.DataFrame
      :param metric: The metric to compute.
      :type metric: str
      :param total: The total number of rows in the DataFrame.
      :type total: int
      :return: The metric value and success/error counts.
      :rtype: tuple(float, int, int)
      """
      if metric != Metrics.ERROR_RATE:
          raise ValueError(
              "Only Error Rate metric currently supported for pyspark case"
          )
      else:
          classes = None
          return compute_metrics_local(df, metric, total, classes)
  
imports: import logging
  import numbers
  from enum import Enum
  import numpy
  import pandas
  from lightgbm import Booster, LGBMClassifier, LGBMRegressor
  from sklearn.metrics import mean_absolute_error, mean_squared_error, median_absolute_error, r2_score
  from erroranalysis._internal.cohort_filter import filter_from_cohort
  from erroranalysis._internal.constants import DIFF, LEAF_INDEX, METHOD, PRED_Y, ROW_INDEX, SPLIT_FEATURE, SPLIT_INDEX, TRUE_Y, CohortFilterMethods, Metrics, ModelTask, TreeNode, error_metrics, f1_metrics, metric_to_display_name, precision_metrics, recall_metrics, regression_metrics
  from erroranalysis._internal.metrics import get_ordered_classes, metric_to_func
  from erroranalysis._internal.process_categoricals import process_categoricals
  from erroranalysis._internal.utils import is_spark
  from raiutils.exceptions import UserConfigValidationException
label_desc: Use image node_id 17 for calling a global function with example usage: compute_metrics_pyspark(df, metric, total) and returns: compute_metrics_local