Skip to content

Commit bb25920

Browse files
committed
Merge branch 'dputler-master'
2 parents 08ff30b + 345f1b8 commit bb25920

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

pkg/R/context.R

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,17 @@ parallelize <- function(sc, coll, numSlices = 1) {
8585
# TODO: bound/safeguard numSlices
8686
# TODO: unit tests for if the split works for all primitives
8787
# TODO: support matrix, data frame, etc
88-
if (!is.list(coll)) {
89-
if (!is.vector(coll)) {
90-
message(paste("context.R: parallelize() currently only supports lists and vectors.",
91-
"Calling as.list() to coerce coll into a list."))
92-
}
88+
if ((!is.list(coll) && !is.vector(coll)) || is.data.frame(coll)) {
89+
if (is.data.frame(coll)) {
90+
message(paste("context.R: A data frame is parallelized by columns."))
91+
} else {
92+
if (is.matrix(coll)) {
93+
message(paste("context.R: A matrix is parallelized by elements."))
94+
} else {
95+
message(paste("context.R: parallelize() currently only supports lists and vectors.",
96+
"Calling as.list() to coerce coll into a list."))
97+
}
98+
}
9399
coll <- as.list(coll)
94100
}
95101

@@ -109,7 +115,6 @@ parallelize <- function(sc, coll, numSlices = 1) {
109115
RDD(jrdd, TRUE)
110116
}
111117

112-
113118
#' Include this specified package on all workers
114119
#'
115120
#' This function can be used to include a package on all workers before the

0 commit comments

Comments
 (0)