code: def test_spark_schema_inference(pandas_df_with_all_types):
      import pyspark
      from pyspark.sql.types import StructField, StructType
  
      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)
      assert schema == Schema(
          [ColSpec(x, x) for x in pandas_df_with_all_types.columns]
      )
      with pyspark.sql.SparkSession.builder.getOrCreate() as spark:
          struct_fields = []
          for t in schema.input_types():
              if t == DataType.datetime:
                  struct_fields.append(
                      StructField(
                          "datetime",
                          _parse_spark_datatype("timestamp"),
                          True,
                      )
                  )
              else:
                  struct_fields.append(
                      StructField(
                          t.name, _parse_spark_datatype(t.name), True
                      )
                  )
          spark_schema = StructType(struct_fields)
          sparkdf = spark.createDataFrame(
              pandas_df_with_all_types, schema=spark_schema
          )
          schema = _infer_schema(sparkdf)
          assert schema == Schema(
              [ColSpec(x, x) for x in pandas_df_with_all_types.columns]
          )
  
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 24 for calling a global function with example usage: test_spark_schema_inference(pandas_df_with_all_types) without return types