code: def schema_inference_example(spark: SparkSession) -> None:
      # $example on:schema_inferring$
      sc = spark.sparkContext
  
      # Load a text file and convert each line to a Row.
      lines = sc.textFile("examples/src/main/resources/people.txt")
      parts = lines.map(lambda l: l.split(","))
      people = parts.map(lambda p: Row(name=p[0], age=int(p[1])))
  
      # Infer the schema, and register the DataFrame as a table.
      schemaPeople = spark.createDataFrame(people)
      schemaPeople.createOrReplaceTempView("people")
  
      # SQL can be run over DataFrames that have been registered as a table.
      teenagers = spark.sql(
          "SELECT name FROM people WHERE age >= 13 AND age <= 19"
      )
  
      # The results of SQL queries are Dataframe objects.
      # rdd returns the content as an :class:`pyspark.RDD` of :class:`Row`.
      teenNames = teenagers.rdd.map(
          lambda p: "Name: " + p.name
      ).collect()
      for name in teenNames:
          print(name)
  
imports: from pyspark.sql import SparkSession
  from pyspark.sql import Row
  from pyspark.sql.types import StringType, StructType, StructField
label_desc: Use image node_id 2 for calling a global function with example usage: schema_inference_example(spark) without return types