code: def verify_arrow_result(
      table, assign_cols_by_name, expected_cols_and_types
  ):
      import pyarrow as pa
  
      if not isinstance(table, pa.Table):
          raise PySparkTypeError(
              error_class="UDF_RETURN_TYPE",
              message_parameters={
                  "expected": "pyarrow.Table",
                  "actual": type(table).__name__,
              },
          )
  
      # the types of the fields have to be identical to return type
      # an empty table can have no columns; if there are columns, they have to match
      if table.num_columns != 0 or table.num_rows != 0:
          # columns are either mapped by name or position
          if assign_cols_by_name:
              actual_cols_and_types = {
                  name: dataType
                  for name, dataType in zip(
                      table.schema.names, table.schema.types
                  )
              }
              missing = sorted(
                  list(
                      set(expected_cols_and_types.keys()).difference(
                          actual_cols_and_types.keys()
                      )
                  )
              )
              extra = sorted(
                  list(
                      set(actual_cols_and_types.keys()).difference(
                          expected_cols_and_types.keys()
                      )
                  )
              )
  
              if missing or extra:
                  missing = (
                      f" Missing: {', '.join(missing)}."
                      if missing
                      else ""
                  )
                  extra = (
                      f" Unexpected: {', '.join(extra)}."
                      if extra
                      else ""
                  )
  
                  raise PySparkRuntimeError(
                      error_class="RESULT_COLUMNS_MISMATCH_FOR_ARROW_UDF",
                      message_parameters={
                          "missing": missing,
                          "extra": extra,
                      },
                  )
  
              column_types = [
                  (
                      name,
                      expected_cols_and_types[name],
                      actual_cols_and_types[name],
                  )
                  for name in sorted(expected_cols_and_types.keys())
              ]
          else:
              actual_cols_and_types = [
                  (name, dataType)
                  for name, dataType in zip(
                      table.schema.names, table.schema.types
                  )
              ]
              column_types = [
                  (expected_name, expected_type, actual_type)
                  for (expected_name, expected_type), (
                      actual_name,
                      actual_type,
                  ) in zip(
                      expected_cols_and_types, actual_cols_and_types
                  )
              ]
  
          type_mismatch = [
              (name, expected, actual)
              for name, expected, actual in column_types
              if actual != expected
          ]
  
          if type_mismatch:
              raise PySparkRuntimeError(
                  error_class="RESULT_TYPE_MISMATCH_FOR_ARROW_UDF",
                  message_parameters={
                      "mismatch": ", ".join(
                          "column '{}' (expected {}, actual {})".format(
                              name, expected, actual
                          )
                          for name, expected, actual in type_mismatch
                      )
                  },
              )
  
imports: import os
  import sys
  import dataclasses
  import time
  import inspect
  import json
  from typing import Any, Callable, Iterable, Iterator, Optional
  import faulthandler
  from pyspark.accumulators import _accumulatorRegistry
  from pyspark.java_gateway import local_connect_and_auth
  from pyspark.taskcontext import BarrierTaskContext, TaskContext
  from pyspark.resource import ResourceInformation
  from pyspark.rdd import PythonEvalType
  from pyspark.serializers import write_int, read_long, read_bool, write_long, read_int, SpecialLengths, UTF8Deserializer, CPickleSerializer, BatchedSerializer
  from pyspark.sql.functions import SkipRestOfInputTableException
  from pyspark.sql.pandas.serializers import ArrowStreamPandasUDFSerializer, ArrowStreamPandasUDTFSerializer, CogroupArrowUDFSerializer, CogroupPandasUDFSerializer, ArrowStreamUDFSerializer, ArrowStreamGroupUDFSerializer, ApplyInPandasWithStateSerializer
  from pyspark.sql.pandas.types import to_arrow_type
  from pyspark.sql.types import ArrayType, BinaryType, DataType, MapType, Row, StringType, StructType, _create_row, _parse_datatype_json_string
  from pyspark.util import fail_on_stopiteration, handle_worker_exception
  from pyspark import shuffle
  from pyspark.errors import PySparkRuntimeError, PySparkTypeError
  from pyspark.worker_util import check_python_version, read_command, pickleSer, send_accumulator_updates, setup_broadcasts, setup_memory_limits, setup_spark_files, utf8_deserializer
label_desc: Use image node_id 11 for calling a global function with example usage: verify_arrow_result(table, assign_cols_by_name, expected_cols_and_types) without return types