code: def test_from_spark_e2e(enable_optimizer, spark):
      spark_df = spark.createDataFrame(
          [(1, "a"), (2, "b"), (3, "c")], ["one", "two"]
      )
  
      rows = [(r.one, r.two) for r in spark_df.take(3)]
      ds = ray.data.from_spark(spark_df)
      assert len(ds.take_all()) == len(rows)
      values = [(r["one"], r["two"]) for r in ds.take(6)]
      assert values == rows
  
      # Check that metadata fetch is included in stats.
      assert "FromArrow" in ds.stats()
      # Underlying implementation uses `FromArrow` operator
      assert ds._plan._logical_plan.dag.name == "FromArrow"
      _check_usage_record(["FromArrow"])
  
file_path: ray/python/ray/data/tests/test_raydp.py
imports: import pandas
  import pytest
  import raydp
  import torch
  import ray
  from ray.data.tests.conftest import *
  from ray.data.tests.test_execution_optimizer import _check_usage_record
label_desc: Use image node_id 4 for calling a global function with example usage: test_from_spark_e2e(enable_optimizer, spark) without return types