You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've drafted a "Use Sedona in R" section for docs/setup/emr.md (plus the emr.zh.md mirror), since there is currently no R deployment guidance anywhere in the mkdocs site — both "Install Sedona R" nav entries point at the generated pkgdown site, which covers the R API but not how to get Sedona onto a cluster.
The parts I could verify against the repo:
apache.sedona registers itself as a sparklyr extension, and the extension's initializer calls SedonaContext.create(spark_session(sc), "r"). So attaching the package before spark_connect() is all that's needed — there's no R equivalent of SedonaContext.create() to call by hand.
SEDONA_JAR_FILES is split on :, and when it's set it replaces both Maven coordinates. So the geotools-wrapper jar has to be listed alongside the Sedona jar, otherwise GeoTools silently goes missing.
Unset, every connection resolves sedona-spark-shaded-<spark>_<scala> and geotools-wrapper from Maven Central, which needs outbound internet from the driver and can exceed the default sparklyr.connect.timeout. Pointing SEDONA_JAR_FILES at the two jars the page's existing bootstrap script already downloads to /jars avoids that entirely.
The R interface rejects Spark 4.x outright (stop("Unsupported Spark version: ") in R/R/dependencies.R), so this is Spark 3.x only.
YARN client mode with spark_home = "/usr/lib/spark" is already the pattern in the R vignette, and that happens to be EMR's Spark home.
What I can't verify without a live cluster, and would like a second pair of eyes on before this is merged:
Which EMR release should this target? The page still documents EMR 6.9.0 / Spark 3.3.0 with sedona-spark-shaded-3.3_2.12. EMR 7.x ships Spark 3.5. I wrote the R section against the page's existing baseline rather than silently changing it, but the whole page is arguably due a refresh.
Does the EMR AMI already ship R? I assumed a bootstrap sudo yum install -y R is needed. If R is present on the AMI at the targeted release, that line should come out.
Which nodes need sparklyr + apache.sedona? In YARN client mode I believe only the primary node (where the driver runs) does, but a bootstrap action runs everywhere. Worth confirming rather than guessing in the docs.
How is R actually meant to be driven on EMR? EMR Studio notebooks have no R/Spark kernel, and AWS has since deprecated the EMR–RStudio integration, so both links in @gregleleu's reply above have aged. Is the expected workflow "SSH to the primary node and run R", or an edge node? This decides whether the section needs an "accessing R" paragraph at all.
Is SEDONA_JAR_FILES even necessary here? The page's spark-defaults classification already sets spark.yarn.dist.jars to the same two /jars paths. If spark_connect() inherits that, the Sys.setenv() block is redundant and should be presented as a no-internet fallback rather than the default.
@gregleleu, since you answered the original question — would you be willing to sanity-check the AWS-side assumptions above? Happy to adjust the draft either way.
Activity
jiayuasu commentedon Sep 22, 2023
@gregleleu Any suggestion?
gregleleu commentedon Sep 24, 2023
The "hard" part is setting up EMR with R, a few resources:
Then you just need to make sure the cluster has the sedona jars. One way is to add the "spark.jars.packages": "" in the configuration.
Maybe more details here: https://arunvelsriram.medium.com/adding-custom-jars-to-spark-jobs-on-aws-emr-ea0eb8507f5
minhpham1810 commentedon Sep 7, 2026
I've drafted a "Use Sedona in R" section for
docs/setup/emr.md(plus theemr.zh.mdmirror), since there is currently no R deployment guidance anywhere in the mkdocs site — both "Install Sedona R" nav entries point at the generated pkgdown site, which covers the R API but not how to get Sedona onto a cluster.The parts I could verify against the repo:
apache.sedonaregisters itself as asparklyrextension, and the extension's initializer callsSedonaContext.create(spark_session(sc), "r"). So attaching the package beforespark_connect()is all that's needed — there's no R equivalent ofSedonaContext.create()to call by hand.SEDONA_JAR_FILESis split on:, and when it's set it replaces both Maven coordinates. So thegeotools-wrapperjar has to be listed alongside the Sedona jar, otherwise GeoTools silently goes missing.sedona-spark-shaded-<spark>_<scala>andgeotools-wrapperfrom Maven Central, which needs outbound internet from the driver and can exceed the defaultsparklyr.connect.timeout. PointingSEDONA_JAR_FILESat the two jars the page's existing bootstrap script already downloads to/jarsavoids that entirely.stop("Unsupported Spark version: ")inR/R/dependencies.R), so this is Spark 3.x only.spark_home = "/usr/lib/spark"is already the pattern in the R vignette, and that happens to be EMR's Spark home.What I can't verify without a live cluster, and would like a second pair of eyes on before this is merged:
sedona-spark-shaded-3.3_2.12. EMR 7.x ships Spark 3.5. I wrote the R section against the page's existing baseline rather than silently changing it, but the whole page is arguably due a refresh.sudo yum install -y Ris needed. If R is present on the AMI at the targeted release, that line should come out.sparklyr+apache.sedona? In YARN client mode I believe only the primary node (where the driver runs) does, but a bootstrap action runs everywhere. Worth confirming rather than guessing in the docs.R", or an edge node? This decides whether the section needs an "accessing R" paragraph at all.SEDONA_JAR_FILESeven necessary here? The page'sspark-defaultsclassification already setsspark.yarn.dist.jarsto the same two/jarspaths. Ifspark_connect()inherits that, theSys.setenv()block is redundant and should be presented as a no-internet fallback rather than the default.@gregleleu, since you answered the original question — would you be willing to sanity-check the AWS-side assumptions above? Happy to adjust the draft either way.
[apacheGH-1024] Add Sedona R instructions to the AWS EMR setup page
[apacheGH-1024] Add Sedona R instructions to the AWS EMR setup page
[GH-1024] Add Sedona R instructions to the AWS EMR setup page (#3334)