code: def assertSchemaEqual(
      actual: StructType,
      expected: StructType,
      ignoreNullable: bool = True,
      ignoreColumnOrder: bool = False,
      ignoreColumnName: bool = False,
  ):
      r"""
      A util function to assert equality between DataFrame schemas `actual` and `expected`.
  
      .. versionadded:: 3.5.0
  
      Parameters
      ----------
      actual : StructType
          The DataFrame schema that is being compared or tested.
      expected : StructType
          The expected schema, for comparison with the actual schema.
      ignoreNullable : bool, default True
          Specifies whether a column’s nullable property is included when checking for
          schema equality.
          When set to `True` (default), the nullable property of the columns being compared
          is not taken into account and the columns will be considered equal even if they have
          different nullable settings.
          When set to `False`, columns are considered equal only if they have the same nullable
          setting.
          .. versionadded:: 4.0.0
      ignoreColumnOrder : bool, default False
          Specifies whether to compare columns in the order they appear in the DataFrame or by
          column name.
          If set to `False` (default), columns are compared in the order they appear in the
          DataFrames.
          When set to `True`, a column in the expected DataFrame is compared to the column with the
          same name in the actual DataFrame.
          .. versionadded:: 4.0.0
      ignoreColumnName : bool, default False
          Specifies whether to fail the initial schema equality check if the column names in the two
          DataFrames are different.
          When set to `False` (default), column names are checked and the function fails if they are
          different.
          When set to `True`, the function will succeed even if column names are different.
          Column data types are compared for columns in the order they appear in the DataFrames.
          .. versionadded:: 4.0.0
  
      Notes
      -----
      When assertSchemaEqual fails, the error message uses the Python `difflib` library to display
      a diff log of the `actual` and `expected` schemas.
  
      Examples
      --------
      >>> from pyspark.sql.types import StructType, StructField, ArrayType, IntegerType, DoubleType
      >>> s1 = StructType([StructField("names", ArrayType(DoubleType(), True), True)])
      >>> s2 = StructType([StructField("names", ArrayType(DoubleType(), True), True)])
      >>> assertSchemaEqual(s1, s2)  # pass, schemas are identical
  
      Different schemas with `ignoreNullable=False` would fail.
  
      >>> s3 = StructType([StructField("names", ArrayType(DoubleType(), True), False)])
      >>> assertSchemaEqual(s1, s3, ignoreNullable=False)  # doctest: +IGNORE_EXCEPTION_DETAIL
      Traceback (most recent call last):
      ...
      PySparkAssertionError: [DIFFERENT_SCHEMA] Schemas do not match.
      --- actual
      +++ expected
      - StructType([StructField('names', ArrayType(DoubleType(), True), True)])
      ?                                                                 ^^^
      + StructType([StructField('names', ArrayType(DoubleType(), True), False)])
      ?                                                                 ^^^^
  
  
      >>> df1 = spark.createDataFrame(data=[(1, 1000), (2, 3000)], schema=["id", "number"])
      >>> df2 = spark.createDataFrame(data=[("1", 1000), ("2", 5000)], schema=["id", "amount"])
      >>> assertSchemaEqual(df1.schema, df2.schema)  # doctest: +IGNORE_EXCEPTION_DETAIL
      Traceback (most recent call last):
      ...
      PySparkAssertionError: [DIFFERENT_SCHEMA] Schemas do not match.
      --- actual
      +++ expected
      - StructType([StructField('id', LongType(), True), StructField('number', LongType(), True)])
      ?                               ^^                               ^^^^^
      + StructType([StructField('id', StringType(), True), StructField('amount', LongType(), True)])
      ?                               ^^^^                              ++++ ^
  
      Compare two schemas ignoring the column order.
  
      >>> s1 = StructType(
      ...     [StructField("a", IntegerType(), True), StructField("b", DoubleType(), True)]
      ... )
      >>> s2 = StructType(
      ...     [StructField("b", DoubleType(), True), StructField("a", IntegerType(), True)]
      ... )
      >>> assertSchemaEqual(s1, s2, ignoreColumnOrder=True)
  
      Compare two schemas ignoring the column names.
  
      >>> s1 = StructType(
      ...     [StructField("a", IntegerType(), True), StructField("c", DoubleType(), True)]
      ... )
      >>> s2 = StructType(
      ...     [StructField("b", IntegerType(), True), StructField("d", DoubleType(), True)]
      ... )
      >>> assertSchemaEqual(s1, s2, ignoreColumnName=True)
      """
      if not isinstance(actual, StructType):
          raise PySparkAssertionError(
              error_class="UNSUPPORTED_DATA_TYPE",
              message_parameters={"data_type": type(actual)},
          )
      if not isinstance(expected, StructType):
          raise PySparkAssertionError(
              error_class="UNSUPPORTED_DATA_TYPE",
              message_parameters={"data_type": type(expected)},
          )
  
      def compare_schemas_ignore_nullable(
          s1: StructType, s2: StructType
      ):
          if len(s1) != len(s2):
              return False
          zipped = zip_longest(s1, s2)
          for sf1, sf2 in zipped:
              if not compare_structfields_ignore_nullable(sf1, sf2):
                  return False
          return True
  
      def compare_structfields_ignore_nullable(
          actualSF: StructField, expectedSF: StructField
      ):
          if actualSF is None and expectedSF is None:
              return True
          elif actualSF is None or expectedSF is None:
              return False
          if actualSF.name != expectedSF.name:
              return False
          else:
              return compare_datatypes_ignore_nullable(
                  actualSF.dataType, expectedSF.dataType
              )
  
      def compare_datatypes_ignore_nullable(dt1: Any, dt2: Any):
          # checks datatype equality, using recursion to ignore nullable
          if dt1.typeName() == dt2.typeName():
              if dt1.typeName() == "array":
                  return compare_datatypes_ignore_nullable(
                      dt1.elementType, dt2.elementType
                  )
              elif dt1.typeName() == "struct":
                  return compare_schemas_ignore_nullable(dt1, dt2)
              else:
                  return True
          else:
              return False
  
      if ignoreColumnOrder:
          actual = StructType(sorted(actual, key=lambda x: x.name))
          expected = StructType(sorted(expected, key=lambda x: x.name))
  
      if ignoreColumnName:
          actual = StructType(
              [
                  StructField(str(i), field.dataType, field.nullable)
                  for i, field in enumerate(actual)
              ]
          )
          expected = StructType(
              [
                  StructField(str(i), field.dataType, field.nullable)
                  for i, field in enumerate(expected)
              ]
          )
  
      if (
          ignoreNullable
          and not compare_schemas_ignore_nullable(actual, expected)
      ) or (not ignoreNullable and actual != expected):
          generated_diff = difflib.ndiff(
              str(actual).splitlines(), str(expected).splitlines()
          )
          error_msg = "\n".join(generated_diff)
          raise PySparkAssertionError(
              error_class="DIFFERENT_SCHEMA",
              message_parameters={"error_msg": error_msg},
          )
  
imports: import glob
  import os
  import struct
  import sys
  import unittest
  import difflib
  import functools
  import math
  from decimal import Decimal
  from time import time, sleep
  from typing import Any, Optional, Union, Dict, List, Callable
  from itertools import zip_longest
  from pyspark import SparkContext, SparkConf
  from pyspark.errors import PySparkAssertionError, PySparkException
  from pyspark.find_spark_home import _find_spark_home
  from pyspark.sql.dataframe import DataFrame
  from pyspark.sql import Row
  from pyspark.sql.types import StructType, StructField
  from pyspark.sql.functions import col, when
  from typing import TYPE_CHECKING
label_desc: Use image node_id 7 for calling a global function with example usage: assertSchemaEqual(actual, expected, ignoreNullable, ignoreColumnOrder, ignoreColumnName) and returns: True, False, True, False, compare_datatypes_ignore_nullable, False, False, False, compare_datatypes_ignore_nullable, compare_schemas_ignore_nullable, True