code: def map_annotations_array(f, output_type: DataType):
      """Creates a Spark UDF to map over an Annotator's array results.
  
      Parameters
      ----------
      f : function
          The function to be applied over the results
      output_type : :class:`pyspark.sql.types.DataType`
          Output type of the data
  
      Returns
      -------
      :func:`pyspark.sql.functions.udf`
          Spark UserDefinedFunction (udf)
      """
      return udf(
          lambda cols: [
              Annotation.toRow(item)
              for item in f(
                  [Annotation.fromRow(r) for col in cols for r in col]
              )
          ],
          output_type,
      )
  
file_path: spark-nlp/python/sparknlp/functions.py
imports: from pyspark.sql.functions import udf, array
  from pyspark.sql.types import *
  from pyspark.sql import DataFrame
  from sparknlp.annotation import Annotation
label_desc: Use image node_id 2 for calling a global function with example usage: map_annotations_array(f, output_type) and returns: udf