code: def _query_statistics(
      total_queries_name: str = TOTAL_QUERIES_NAME,
      total_documents_name: str = TOTAL_DOCUMENTS_NAME,
      min_documents_name: str = MIN_DOCUMENTS_NAME,
      max_documents_name: str = MAX_DOCUMENTS_NAME,
      eval_config: Optional[config_pb2.EvalConfig] = None,
      model_name: str = "",
      output_name: str = "",
      query_key: str = "",
      example_weighted: bool = False,
  ) -> metric_types.MetricComputations:
      """Returns metric computations for query statistics."""
      if not query_key:
          raise ValueError(
              "a query_key is required to use QueryStatistics metrics"
          )
  
      total_queries_key = metric_types.MetricKey(
          name=total_queries_name,
          model_name=model_name,
          output_name=output_name,
          example_weighted=example_weighted,
      )
      total_documents_key = metric_types.MetricKey(
          name=total_documents_name,
          model_name=model_name,
          output_name=output_name,
          example_weighted=example_weighted,
      )
      min_documents_key = metric_types.MetricKey(
          name=min_documents_name,
          model_name=model_name,
          output_name=output_name,
          example_weighted=example_weighted,
      )
      max_documents_key = metric_types.MetricKey(
          name=max_documents_name,
          model_name=model_name,
          output_name=output_name,
          example_weighted=example_weighted,
      )
  
      return [
          metric_types.MetricComputation(
              keys=[
                  total_queries_key,
                  total_documents_key,
                  min_documents_key,
                  max_documents_key,
              ],
              preprocessors=None,
              combiner=_QueryStatisticsCombiner(
                  total_queries_key,
                  total_documents_key,
                  min_documents_key,
                  max_documents_key,
                  eval_config,
                  model_name,
                  output_name,
                  example_weighted,
              ),
          )
      ]
  
file_path: model-analysis/tensorflow_model_analysis/metrics/query_statistics.py
imports: from typing import Dict, Iterable, Optional
  import apache_beam
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: _query_statistics(total_queries_name, total_documents_name, min_documents_name, max_documents_name, eval_config, model_name, output_name, query_key, example_weighted) and returns: list