code: def _test() -> None:
      import os
      import doctest
      import tempfile
      from pyspark.context import SparkContext
      from pyspark.sql import Row, SQLContext
      import pyspark.sql.context
  
      os.chdir(os.environ["SPARK_HOME"])
  
      globs = pyspark.sql.context.__dict__.copy()
      sc = SparkContext("local[4]", "PythonTest")
      globs["tempfile"] = tempfile
      globs["os"] = os
      globs["sc"] = sc
      globs["sqlContext"] = SQLContext(sc)
      globs["rdd"] = rdd = sc.parallelize(
          [
              Row(field1=1, field2="row1"),
              Row(field1=2, field2="row2"),
              Row(field1=3, field2="row3"),
          ]
      )
      globs["df"] = rdd.toDF()
      jsonStrings = [
          '{"field1": 1, "field2": "row1", "field3":{"field4":11}}',
          '{"field1" : 2, "field3":{"field4":22, "field5": [10, 11]},"field6":[{"field7": "row2"}]}',
          '{"field1" : null, "field2": "row3", "field3":{"field4":33, "field5": []}}',
      ]
      globs["jsonStrings"] = jsonStrings
      globs["json"] = sc.parallelize(jsonStrings)
      (failure_count, test_count) = doctest.testmod(
          pyspark.sql.context,
          globs=globs,
          optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE,
      )
      globs["sc"].stop()
      if failure_count:
          sys.exit(-1)
  
imports: import sys
  import warnings
  from typing import Optional, Union, Callable, Any, Iterable, List, Tuple, overload, Type, ClassVar, TYPE_CHECKING, cast
  from py4j.java_gateway import JavaObject
  from pyspark import _NoValue
  from pyspark._globals import _NoValueType
  from pyspark.sql.session import _monkey_patch_RDD, SparkSession
  from pyspark.sql.dataframe import DataFrame
  from pyspark.sql.readwriter import DataFrameReader
  from pyspark.sql.streaming import DataStreamReader
  from pyspark.sql.udf import UDFRegistration
  from pyspark.sql.udtf import UDTFRegistration
  from pyspark.errors.exceptions.captured import install_exception_handler
  from pyspark.context import SparkContext
  from pyspark.rdd import RDD
  from pyspark.sql.types import AtomicType, DataType, StructType
  from pyspark.sql.streaming import StreamingQueryManager
label_desc: Use image node_id 1 for calling a global function with example usage: _test() without return types