code: def basic_datasource_example(spark: SparkSession) -> None:
      # $example on:generic_load_save_functions$
      users_df = spark.read.load(
          "examples/src/main/resources/users.parquet"
      )
      users_df.select("name", "favorite_color").write.save(
          "namesAndFavColors.parquet"
      )
      # $example off:generic_load_save_functions$
  
      # $example on:write_partitioning$
      users_df = spark.read.load(
          "examples/src/main/resources/users.parquet"
      )
      users_df.write.partitionBy("favorite_color").format(
          "parquet"
      ).save("namesPartByColor.parquet")
      # $example off:write_partitioning$
  
      # $example on:write_partition_and_bucket$
      users_df = spark.read.parquet(
          "examples/src/main/resources/users.parquet"
      )
      (
          users_df.write.partitionBy("favorite_color")
          .bucketBy(42, "name")
          .saveAsTable("users_partitioned_bucketed")
      )
      # $example off:write_partition_and_bucket$
  
      # $example on:manual_load_options$
      people_df = spark.read.load(
          "examples/src/main/resources/people.json", format="json"
      )
      people_df.select("name", "age").write.save(
          "namesAndAges.parquet", format="parquet"
      )
      # $example off:manual_load_options$
  
      # $example on:manual_load_options_csv$
      people_df = spark.read.load(
          "examples/src/main/resources/people.csv",
          format="csv",
          sep=";",
          inferSchema="true",
          header="true",
      )
      # $example off:manual_load_options_csv$
  
      # $example on:manual_save_options_orc$
      users_df = spark.read.orc("examples/src/main/resources/users.orc")
      (
          users_df.write.format("orc")
          .option("orc.bloom.filter.columns", "favorite_color")
          .option("orc.dictionary.key.threshold", "1.0")
          .option("orc.column.encoding.direct", "name")
          .save("users_with_options.orc")
      )
      # $example off:manual_save_options_orc$
  
      # $example on:manual_save_options_parquet$
      users_df = spark.read.parquet(
          "examples/src/main/resources/users.parquet"
      )
      (
          users_df.write.format("parquet")
          .option("parquet.bloom.filter.enabled#favorite_color", "true")
          .option(
              "parquet.bloom.filter.expected.ndv#favorite_color",
              "1000000",
          )
          .option("parquet.enable.dictionary", "true")
          .option("parquet.page.write-checksum.enabled", "false")
          .save("users_with_options.parquet")
      )
      # $example off:manual_save_options_parquet$
  
      # $example on:write_sorting_and_bucketing$
      people_df = spark.read.json(
          "examples/src/main/resources/people.json"
      )
      people_df.write.bucketBy(42, "name").sortBy("age").saveAsTable(
          "people_bucketed"
      )
      # $example off:write_sorting_and_bucketing$
  
      # $example on:direct_sql$
      df = spark.sql(
          "SELECT * FROM parquet.`examples/src/main/resources/users.parquet`"
      )
      # $example off:direct_sql$
  
      spark.sql("DROP TABLE IF EXISTS people_bucketed")
      spark.sql("DROP TABLE IF EXISTS users_partitioned_bucketed")
  
file_path: spark/examples/src/main/python/sql/datasource.py
imports: from pyspark.sql import SparkSession
  from pyspark.sql import Row
label_desc: Use image node_id 2 for calling a global function with example usage: basic_datasource_example(spark) without return types