code: def force_decimal_precision_scale(
      dt: DataType, *, precision: int = 38, scale: int = 18
  ) -> DataType:
      """
      Returns a data type with a fixed decimal type.
  
      The precision and scale of the decimal type are fixed with the given values.
  
      Examples
      --------
      >>> from pyspark.sql.types import *
      >>> force_decimal_precision_scale(StructType([
      ...     StructField("A", DecimalType(10, 0), True),
      ...     StructField("B", DecimalType(14, 7), False)]))  # doctest: +NORMALIZE_WHITESPACE
      StructType([StructField('A', DecimalType(38,18), True),
                  StructField('B', DecimalType(38,18), False)])
  
      >>> force_decimal_precision_scale(StructType([
      ...     StructField("A",
      ...         StructType([
      ...             StructField('a',
      ...                 MapType(DecimalType(5, 0),
      ...                 ArrayType(DecimalType(20, 0), False), False), False),
      ...             StructField('b', StringType(), True)])),
      ...     StructField("B", DecimalType(30, 15), False)]),
      ...     precision=30, scale=15)  # doctest: +NORMALIZE_WHITESPACE
      StructType([StructField('A',
          StructType([StructField('a',
              MapType(DecimalType(30,15),
              ArrayType(DecimalType(30,15), False), False), False),
          StructField('b', StringType(), True)]), True),
      StructField('B', DecimalType(30,15), False)])
      """
      if isinstance(dt, StructType):
          new_fields = []
          for field in dt.fields:
              new_fields.append(
                  StructField(
                      field.name,
                      force_decimal_precision_scale(
                          field.dataType,
                          precision=precision,
                          scale=scale,
                      ),
                      nullable=field.nullable,
                      metadata=field.metadata,
                  )
              )
          return StructType(new_fields)
      elif isinstance(dt, ArrayType):
          return ArrayType(
              force_decimal_precision_scale(
                  dt.elementType, precision=precision, scale=scale
              ),
              containsNull=dt.containsNull,
          )
      elif isinstance(dt, MapType):
          return MapType(
              force_decimal_precision_scale(
                  dt.keyType, precision=precision, scale=scale
              ),
              force_decimal_precision_scale(
                  dt.valueType, precision=precision, scale=scale
              ),
              valueContainsNull=dt.valueContainsNull,
          )
      elif isinstance(dt, DecimalType):
          return DecimalType(precision=precision, scale=scale)
      else:
          return dt
  
file_path: spark/python/pyspark/pandas/spark/utils.py
imports: from typing import overload
  from pyspark.sql.types import DecimalType, StructType, MapType, ArrayType, StructField, DataType
label_desc: Use image node_id 10 for calling a global function with example usage: force_decimal_precision_scale(dt) and returns: StructType, ArrayType, MapType, DecimalType, dt