Github user yanboliang commented on a diff in the pull request:
https://github.com/apache/spark/pull/17274#discussion_r106182427
--- Diff: R/pkg/R/context.R ---
@@ -345,7 +351,8 @@ spark.getSparkFilesRootDirectory <- function() {
#'}
#' @note spark.getSparkFiles since 2.1.0
spark.getSparkFiles <- function(fileName) {
- callJStatic("org.apache.spark.SparkFiles", "get", as.character(fileName))
+ rootDir <- spark.getSparkFilesRootDirectory()
+ paste0(rootDir, "/", as.character(fileName))
--- End diff --
Do you suggest to write as follow?
```
if (Sys.getenv("SPARKR_IS_RUNNING_ON_WORKER") == "") {
callJStatic("org.apache.spark.SparkFiles", "get",
as.character(fileName))
} else {
file.path(spark.getSparkFilesRootDirectory(), as.character(fileName))
}
```
It will check ```Sys.getenv("SPARKR_IS_RUNNING_ON_WORKER")``` twice for the
case of running on worker, since we always make this check in
```spark.getSparkFilesRootDirectory```. So I'm more prefer the current style.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]