code: def test_spark_session_factory_configuration():
      env_helper = Mock()
      spark_config = {"spark.test.key": "spark.test.value"}
      spark_session_factory = SparkSessionFactory(
          env_helper, spark_config
      )
      spark_configs = dict(
          spark_session_factory._get_spark_configs(
              is_training_job=False
          )
      )
      jsc_hadoop_configs = dict(
          spark_session_factory._get_jsc_hadoop_configs()
      )
  
      # General optimizations
      assert spark_configs.get(
          "spark.hadoop.fs.s3a.aws.credentials.provider"
      ) == ",".join(
          [
              "com.amazonaws.auth.ContainerCredentialsProvider",
              "com.amazonaws.auth.profile.ProfileCredentialsProvider",
              "com.amazonaws.auth.DefaultAWSCredentialsProviderChain",
          ]
      )
  
      assert (
          spark_configs.get(
              "spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version"
          )
          == "2"
      )
      assert (
          spark_configs.get(
              "spark.hadoop.mapreduce.fileoutputcommitter.cleanup-failures.ignored"
          )
          == "true"
      )
      assert (
          spark_configs.get(
              "spark.hadoop.parquet.enable.summary-metadata"
          )
          == "false"
      )
  
      assert (
          spark_configs.get("spark.sql.parquet.mergeSchema") == "false"
      )
      assert (
          spark_configs.get("spark.sql.parquet.filterPushdown")
          == "true"
      )
      assert (
          spark_configs.get("spark.sql.hive.metastorePartitionPruning")
          == "true"
      )
  
      assert (
          spark_configs.get("spark.hadoop.fs.s3a.threads.max") == "500"
      )
      assert (
          spark_configs.get("spark.hadoop.fs.s3a.connection.maximum")
          == "500"
      )
      assert (
          spark_configs.get(
              "spark.hadoop.fs.s3a.experimental.input.fadvise"
          )
          == "normal"
      )
      assert (
          spark_configs.get("spark.hadoop.fs.s3a.block.size") == "128M"
      )
      assert (
          spark_configs.get("spark.hadoop.fs.s3a.fast.upload.buffer")
          == "disk"
      )
      assert spark_configs.get("spark.hadoop.fs.trash.interval") == "0"
      assert spark_configs.get("spark.port.maxRetries") == "50"
  
      assert spark_configs.get("spark.test.key") == "spark.test.value"
  
      assert (
          jsc_hadoop_configs.get(
              "mapreduce.fileoutputcommitter.marksuccessfuljobs"
          )
          == "false"
      )
  
      # Verify configurations when not running on a training job
      assert ",".join(
          feature_store_pyspark.classpath_jars()
      ) in spark_configs.get("spark.jars")
      assert ",".join(
          [
              "org.apache.hadoop:hadoop-aws:3.3.1",
              "org.apache.hadoop:hadoop-common:3.3.1",
          ]
      ) in spark_configs.get("spark.jars.packages")
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/feature_store/feature_processor/test_spark_session_factory.py
imports: from __future__ import absolute_import
  import feature_store_pyspark
  import pytest
  from mock import Mock, patch, call
  from sagemaker.feature_store.feature_processor._spark_factory import FeatureStoreManagerFactory, SparkSessionFactory
label_desc: Use image node_id 2 for calling a global function with example usage: test_spark_session_factory_configuration() without return types