code: def _check_spark_dataset(
      dataset,
      original_df,
      df_spark,
      expected_source_type,
      expected_name=None,
  ):
      assert isinstance(dataset, SparkDataset)
      _assert_dataframes_equal(dataset.df, df_spark)
      assert dataset.schema == _infer_schema(original_df)
      assert isinstance(dataset.profile, dict)
      approx_count = dataset.profile.get("approx_count")
      assert isinstance(approx_count, int) or approx_count == "unknown"
      assert isinstance(dataset.source, expected_source_type)
      # NB: In real-world scenarios, Spark dataset sources may not match Spark DataFrames precisely.
      # For example, users may transform Spark DataFrames after loading contents from source files.
      # To ensure that source loading works properly for the purpose of the test cases in this suite,
      # we require the source to match the DataFrame and make the following equality assertion
      _assert_dataframes_equal(dataset.source.load(), df_spark)
      if expected_name is not None:
          assert dataset.name == expected_name
  
imports: import json
  import os
  import pandas
  import pytest
  import mlflow.data
  from mlflow.data.code_dataset_source import CodeDatasetSource
  from mlflow.data.delta_dataset_source import DeltaDatasetSource
  from mlflow.data.spark_dataset import SparkDataset
  from mlflow.data.spark_dataset_source import SparkDatasetSource
  from mlflow.exceptions import MlflowException
  from mlflow.models.evaluation.base import EvaluationDataset
  from mlflow.types.schema import Schema
  from mlflow.types.utils import _infer_schema
label_desc: Use image node_id 4 for calling a global function with example usage: _check_spark_dataset(dataset, original_df, df_spark, expected_source_type, expected_name) without return types