code: def test_spark_type_mapping(pandas_df_with_all_types):
      import pyspark
      from pyspark.sql.types import (
          BinaryType,
          BooleanType,
          DoubleType,
          FloatType,
          IntegerType,
          LongType,
          StringType,
          StructField,
          StructType,
          TimestampType,
      )
  
      assert isinstance(DataType.boolean.to_spark(), BooleanType)
      assert isinstance(DataType.integer.to_spark(), IntegerType)
      assert isinstance(DataType.long.to_spark(), LongType)
      assert isinstance(DataType.float.to_spark(), FloatType)
      assert isinstance(DataType.double.to_spark(), DoubleType)
      assert isinstance(DataType.string.to_spark(), StringType)
      assert isinstance(DataType.binary.to_spark(), BinaryType)
      assert isinstance(DataType.datetime.to_spark(), TimestampType)
      pandas_df_with_all_types = pandas_df_with_all_types.drop(
          columns=["boolean_ext", "integer_ext", "string_ext"]
      )
      schema = _infer_schema(pandas_df_with_all_types)
      expected_spark_schema = StructType(
          [
              StructField(t.name, t.to_spark(), False)
              for t in schema.input_types()
          ]
      )
      actual_spark_schema = schema.as_spark_schema()
      assert (
          expected_spark_schema.jsonValue()
          == actual_spark_schema.jsonValue()
      )
      with pyspark.sql.SparkSession(
          pyspark.SparkContext.getOrCreate()
      ) as spark_session:
          sparkdf = spark_session.createDataFrame(
              pandas_df_with_all_types, schema=actual_spark_schema
          )
          schema2 = _infer_schema(sparkdf)
          assert schema == schema2
  
      # test unnamed columns
      schema = Schema([ColSpec(col.type) for col in schema.inputs])
      expected_spark_schema = StructType(
          [
              StructField(str(i), t.to_spark(), False)
              for i, t in enumerate(schema.input_types())
          ]
      )
      actual_spark_schema = schema.as_spark_schema()
      assert (
          expected_spark_schema.jsonValue()
          == actual_spark_schema.jsonValue()
      )
  
      # test single unnamed column is mapped to just a single spark type
      schema = Schema([ColSpec(DataType.integer)])
      spark_type = schema.as_spark_schema()
      assert isinstance(spark_type, IntegerType)
  
imports: import datetime
  import json
  import math
  import re
  import numpy
  import pandas
  import pyspark
  import pyspark.sql.types
  import pytest
  from scipy.sparse import csc_matrix, csr_matrix
  from mlflow.exceptions import MlflowException
  from mlflow.models.utils import _enforce_tensor_spec
  from mlflow.pyfunc import _parse_spark_datatype
  from mlflow.types import DataType
  from mlflow.types.schema import Array, ColSpec, Object, ParamSchema, ParamSpec, Property, Schema, TensorSpec
  from mlflow.types.utils import _get_tensor_shape, _infer_colspec_type, _infer_param_schema, _infer_schema, _validate_input_dictionary_contains_only_strings_and_lists_of_strings
label_desc: Use image node_id 26 for calling a global function with example usage: test_spark_type_mapping(pandas_df_with_all_types) without return types