Skip to content

Commit 345f1b8

Browse files
committed
[SPARKR-195] Implemented project style guidelines for if-else statements
1 parent 0c53d6c commit 345f1b8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

pkg/R/context.R

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +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) && !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 if (is.matrix(coll))
92-
message(paste("context.R: A matrix is parallelized by elements."))
93-
else
94-
message(paste("context.R: parallelize() currently only supports lists and vectors.",
95-
"Calling as.list() to coerce coll into a list."))
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+
}
9699
coll <- as.list(coll)
97100
}
98101

0 commit comments

Comments
 (0)