Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix docs.
  • Loading branch information
yanboliang committed Sep 18, 2016
commit 65be499606231d18b68bd24d1101427ad31a4b11
11 changes: 8 additions & 3 deletions R/pkg/R/context.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,30 +228,35 @@ setCheckpointDir <- function(sc, dirName) {
#' Add a file or directory to be downloaded with this Spark job on every node.
#'
#' The path passed can be either a local file, a file in HDFS (or other Hadoop-supported
#' filesystems), or an HTTP, HTTPS or FTP URI. To access the file in Spark jobs,
#' filesystems), or an HTTP, HTTPS or FTP URI. To access the file in Spark jobs,
#' use sparkFiles.get(fileName) to find its download location.
#'
#' A directory can be given if the recursive option is set to true.
#' Currently directories are only supported for Hadoop-supported filesystems.
#'
#' @param path The path of the files to be added
#' @param path The path of the file to be added
#' @param recursive Recursive or not if the path is directory. Default is FALSE.
#' @noRd
#' @examples
#'\dontrun{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add @export

#' sc <- sparkR.init()
#' addFile(sc, "myfile")
#' addFile(sc, "~/myfile")
#'}
addFile <- function(sc, path) {
invisible(callJMethod(sc, "addFile", suppressWarnings(normalizePath(path))))
}

#' Get the root directory that contains files added through addFile.
#'
#' @noRd
sparkFiles.getRootDirectory <- function() {
callJStatic("org.apache.spark.SparkFiles", "getRootDirectory")
}

#' Get the absolute path of a file added through addFile.
#'
#' @param fileName The name of the file added through addFile
#' @noRd
sparkFiles.get <- function(fileName) {
callJStatic("org.apache.spark.SparkFiles", "get", as.character(fileName))
}
Expand Down