code: def test_raydp_to_spark(spark):
      n = 5
      ds = ray.data.range(n)
      values = [r["id"] for r in ds.take(5)]
      df = ds.to_spark(spark)
      rows = [r.id for r in df.take(5)]
      assert values == rows
  
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 3 for calling a global function with example usage: test_raydp_to_spark(spark) without return types