Skip to content

Commit 378b437

Browse files
committed
comments
1 parent 9ca6e15 commit 378b437

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

R/pkg/R/context.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ setCheckpointDir <- function(sc, dirName) {
243243
#'
244244
#' - loading external packages: In order to use a package, you need to load it inside the
245245
#' closure. For example, if you rely on the MASS module, here is how you would use it:
246-
#'
247246
#'\dontrun{
248247
#' train <- function(hyperparam) {
249248
#' library(MASS)
@@ -253,6 +252,7 @@ setCheckpointDir <- function(sc, dirName) {
253252
#'}
254253
#'
255254
#' @rdname spark.lapply
255+
#' @param sc Spark Context to use
256256
#' @param list the list of elements
257257
#' @param func a function that takes one argument.
258258
#' @return a list of results (the exact type being determined by the function)
@@ -261,8 +261,7 @@ setCheckpointDir <- function(sc, dirName) {
261261
#'\dontrun{
262262
#' doubled <- spark.lapply(1:10, function(x){2 * x})
263263
#'}
264-
spark.lapply <- function(list, func) {
265-
sc <- get(".sparkRjsc", envir = .sparkREnv)
264+
spark.lapply <- function(sc, list, func) {
266265
rdd <- parallelize(sc, list, length(list))
267266
results <- map(rdd, func)
268267
local <- collect(results)

R/pkg/inst/tests/testthat/test_context.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ test_that("sparkJars sparkPackages as comma-separated strings", {
142142
expect_match(processSparkJars(f), f)
143143
})
144144

145-
test_that("sparkLapply should perform simple transforms", {
146-
doubled <- spark.lapply(1:10, function(x){2 * x})
145+
test_that("spark.lapply should perform simple transforms", {
146+
sc <- sparkR.init()
147+
doubled <- spark.lapply(sc, 1:10, function(x) { 2 * x })
147148
expect_equal(doubled, as.list(2 * 1:10))
148149
})

0 commit comments

Comments
 (0)