Skip to content

Commit e70df5d

Browse files
committed
[Minor] Fix some validation problems in SparkR
1 parent d41d6c4 commit e70df5d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

R/pkg/R/DataFrame.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,15 +661,15 @@ setMethod("collect",
661661
# listCols is a list of columns
662662
listCols <- callJStatic("org.apache.spark.sql.api.r.SQLUtils", "dfToCols", x@sdf)
663663
stopifnot(length(listCols) == ncol)
664-
664+
665665
# An empty data.frame with 0 columns and number of rows as collected
666666
nrow <- length(listCols[[1]])
667667
if (nrow <= 0) {
668668
df <- data.frame()
669669
} else {
670-
df <- data.frame(row.names = 1 : nrow)
670+
df <- data.frame(row.names = 1 : nrow)
671671
}
672-
672+
673673
# Append columns one by one
674674
for (colIndex in 1 : ncol) {
675675
# Note: appending a column of list type into a data.frame so that
@@ -683,7 +683,7 @@ setMethod("collect",
683683
# TODO: more robust check on column of primitive types
684684
vec <- do.call(c, col)
685685
if (class(vec) != "list") {
686-
df[[names[colIndex]]] <- vec
686+
df[[names[colIndex]]] <- vec
687687
} else {
688688
# For columns of complex type, be careful to access them.
689689
# Get a column of complex type returns a list.

R/pkg/inst/tests/test_Serde.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ test_that("SerDe of primitive types", {
2323
x <- callJStatic("SparkRHandler", "echo", 1L)
2424
expect_equal(x, 1L)
2525
expect_equal(class(x), "integer")
26-
26+
2727
x <- callJStatic("SparkRHandler", "echo", 1)
2828
expect_equal(x, 1)
2929
expect_equal(class(x), "numeric")
3030

3131
x <- callJStatic("SparkRHandler", "echo", TRUE)
3232
expect_true(x)
3333
expect_equal(class(x), "logical")
34-
34+
3535
x <- callJStatic("SparkRHandler", "echo", "abc")
3636
expect_equal(x, "abc")
37-
expect_equal(class(x), "character")
37+
expect_equal(class(x), "character")
3838
})
3939

4040
test_that("SerDe of list of primitive types", {
@@ -47,17 +47,17 @@ test_that("SerDe of list of primitive types", {
4747
y <- callJStatic("SparkRHandler", "echo", x)
4848
expect_equal(x, y)
4949
expect_equal(class(y[[1]]), "numeric")
50-
50+
5151
x <- list(TRUE, FALSE)
5252
y <- callJStatic("SparkRHandler", "echo", x)
5353
expect_equal(x, y)
5454
expect_equal(class(y[[1]]), "logical")
55-
55+
5656
x <- list("a", "b", "c")
5757
y <- callJStatic("SparkRHandler", "echo", x)
5858
expect_equal(x, y)
5959
expect_equal(class(y[[1]]), "character")
60-
60+
6161
# Empty list
6262
x <- list()
6363
y <- callJStatic("SparkRHandler", "echo", x)

R/pkg/inst/tests/test_sparkSQL.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ test_that("subsetting", {
608608
df4 <- df[df$age %in% c(19, 30), 1:2]
609609
expect_equal(count(df4), 2)
610610
expect_equal(columns(df4), c("name", "age"))
611-
611+
612612
df5 <- df[df$age %in% c(19), c(1,2)]
613613
expect_equal(count(df5), 1)
614614
expect_equal(columns(df5), c("name", "age"))

0 commit comments

Comments
 (0)