Skip to content

Add Spark Connect support for Spark datasets - #8392

Open
zhengruifeng wants to merge 1 commit into
huggingface:mainfrom
zhengruifeng:add-spark-connect-support
Open

Add Spark Connect support for Spark datasets#8392
zhengruifeng wants to merge 1 commit into
huggingface:mainfrom
zhengruifeng:add-spark-connect-support

Conversation

@zhengruifeng

Copy link
Copy Markdown

What does this PR do?

Adds Spark Connect support to Dataset.from_spark and IterableDataset.from_spark by replacing client-side RDD and SparkContext calls with DataFrame APIs supported by Spark Connect.

  • discovers partitions with spark_partition_id() for streaming datasets
  • runs the shared-cache probe with mapInArrow
  • distributes shard renames with createDataFrame and mapInArrow
  • adds coverage for partition discovery, empty DataFrames, the remote-cache probe, and multi-shard output

Testing

  • ruff check src/datasets/packaged_modules/spark/spark.py tests/packaged_modules/test_spark.py tests/test_arrow_dataset.py
  • ruff format --check src/datasets/packaged_modules/spark/spark.py tests/packaged_modules/test_spark.py tests/test_arrow_dataset.py
  • PySpark 4.2 classic and Spark Connect smoke tests for partition discovery, worker cache probing, and distributed shard renaming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant