Jump to content

SparkR

From Open Lakehouse Wiki
SparkR
Developer Apache Software Foundation (Apache Spark project)
Initial release Spark 1.4.0
Latest release Spark 4.3.0
(2026-10-30)
Written in R, Scala
Type R language frontend for Apache Spark
License Apache License 2.0
Website SparkR (R on Spark)
Repository github.com/apache/spark (R/)
Related Apache Spark, Spark Connect, MLlib
Last verified 22 November 2026 against the v4.0.0 to v4.3.0 tags of apache/spark (docs/sparkr.md, docs/sparkr-migration-guide.md, R/pkg/DESCRIPTION, R/pkg/R/zzz.R), the Spark 1.4.0, 4.0.0, 4.1.0, 4.2.0 and 4.3.0 release notes, SPARK-49347 and the August 2024 dev-list discussion and vote.
Status: Deprecated since Apache Spark 4.0.0. Use the separately maintained sparklyr package instead. SparkR is still included in Spark 4.3.0 and has not been removed.[1]

SparkR is the R package that ships with Apache Spark and lets R programs use Spark: it provides a distributed data frame, the SparkDataFrame, with selection, filtering and aggregation, and access to Spark's machine learning library.[2] SparkR is deprecated as of Spark 4.0.0 and will be removed in a future version, but it is still part of every release up to Spark 4.3.0.[2][1] The Spark project points R users to sparklyr, a separate R package for Spark.[3]

Status

SparkR was deprecated in Spark 4.0.0 under SPARK-49347, after a vote on the Spark dev mailing list.[1][4] The deprecation shows up in three places in Spark 4.x:

  • Programming guide. The SparkR guide opens with the sentence that SparkR is deprecated from Spark 4.0.0 and will be removed in a future version.[2]
  • Migration guide. The SparkR migration guide says, under "Upgrading from SparkR 3.5 to 4.0", that SparkR is deprecated and will be removed in a future version.[5]
  • Startup message. When the package is attached, SparkR prints a warning that it is deprecated and recommends sparklyr. Setting the environment variable SPARKR_SUPPRESS_DEPRECATION_WARNING to any non-empty value hides the message.[3]

SparkR has not been removed. The R/pkg directory is present at the v4.1.0, v4.2.0 and v4.3.0 tags, with the package version matching each Spark release.[6] The Spark 4.1.0 release notes do not mention SparkR. The 4.2.0 release notes list maintenance work on it, such as Java 25 support and dropping support for R 3.x, and none of the 4.x release notes announce a removal.[7][8][9]

Why it was deprecated

The proposal came from Shivaram Venkataraman, who created the original SparkR package as research at UC Berkeley. In an August 2024 thread on the Spark dev mailing list he argued that sparklyr is more idiomatic R than SparkR's Scala-like API, that contributions to SparkR had slowed, that sparklyr's newer Spark Connect based architecture removed the need to align its version with Spark's, and that sparklyr is maintained on CRAN while SparkR could not stay there under Spark's release process.[10] The vote to deprecate SparkR followed on 21 August 2024, and the deprecation was merged for Spark 4.0.0.[11][1]

History

Spark 1.4.0 was the first release to package SparkR, described in the release notes as an R binding built on Spark's then-new DataFrame API.[12] The SparkR package in Spark 4.3.0 requires R 4.0 or later and Java 17 or later.[6]

How it works

SparkR starts or connects to a Spark application through sparkR.session(), which creates a SparkSession. From RStudio or another R environment, SparkR uses SPARK_HOME to find a Spark installation and can download one if none is found.[2] R code talks to the Spark driver JVM through a backend in Spark core (org.apache.spark.api.r.RBackend).[13] The guide also documents running R functions on the data with dapply and gapply, Apache Arrow for faster transfer between the JVM and R, and MLlib model training.[2]

The following R example runs with the Spark 4.3 distribution. It starts a session, converts the built-in faithful data frame to a SparkDataFrame and filters it.

library(SparkR)
sparkR.session(appName = "faithful-example")

df <- createDataFrame(faithful)
head(filter(df, df$waiting < 50))

sparkR.session.stop()

Comparison with sparklyr

SparkR sparklyr
Maintained by The Apache Spark project, inside the Spark repository[6] A separate open source project (github.com/sparklyr/sparklyr)[14]
Status Deprecated since Spark 4.0.0[1] Recommended by the SparkR startup message[3]
Installation Ships with the Spark distribution; not maintained on CRAN[10] install.packages("sparklyr") from CRAN[14]
API style Its own functions over SparkDataFrame (filter, select, agg)[2] Described in the deprecation proposal as more idiomatic R[10]
Spark Connect Not a Spark Connect client; connects through the R backend in the driver spark_connect(method = "spark_connect")[14]

See also

References

  1. ↑ 1.0 1.1 1.2 1.3 1.4 SPARK-49347: Deprecate SparkR. Apache Software Foundation JIRA.Retrieved 2026-11-22.
  2. ↑ 2.0 2.1 2.2 2.3 2.4 2.5 SparkR (R on Spark) (docs/sparkr.md at v4.3.0). Apache Software Foundation.Retrieved 2026-11-22.
  3. ↑ 3.0 3.1 3.2 R/pkg/R/zzz.R (v4.3.0). Apache Software Foundation.Retrieved 2026-11-22.
  4. ↑ Spark Release 4.0.0. Apache Software Foundation.Retrieved 2026-11-22.
  5. ↑ Migration Guide: SparkR (R on Spark) (docs/sparkr-migration-guide.md at v4.3.0). Apache Software Foundation.Retrieved 2026-11-22.
  6. ↑ 6.0 6.1 6.2 R/pkg/DESCRIPTION (v4.3.0). Apache Software Foundation.Retrieved 2026-11-22.
  7. ↑ Spark Release 4.1.0. Apache Software Foundation.Retrieved 2026-11-22.
  8. ↑ Spark Release 4.2.0. Apache Software Foundation.Retrieved 2026-11-22.
  9. ↑ Spark Release 4.3.0. Apache Software Foundation.Retrieved 2026-11-22.
  10. ↑ 10.0 10.1 10.2 [DISCUSS Deprecating SparkR]. [email protected], 2024-08-12.Retrieved 2026-11-22.
  11. ↑ [VOTE Deprecate SparkR]. [email protected], 2024-08-21.Retrieved 2026-11-22.
  12. ↑ Spark Release 1.4.0. Apache Software Foundation.Retrieved 2026-11-22.
  13. ↑ core/src/main/scala/org/apache/spark/api/r at v4.3.0. GitHub.Retrieved 2026-11-22.
  14. ↑ 14.0 14.1 14.2 Get Started (sparklyr). Posit.Retrieved 2026-11-22.