aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/pkg/R/DataFrame.R4
-rw-r--r--R/pkg/inst/tests/testthat/test_sparkSQL.R6
2 files changed, 8 insertions, 2 deletions
diff --git a/R/pkg/R/DataFrame.R b/R/pkg/R/DataFrame.R
index cc4cfa3423..e33d0d8e29 100644
--- a/R/pkg/R/DataFrame.R
+++ b/R/pkg/R/DataFrame.R
@@ -280,7 +280,7 @@ setMethod("dtypes",
#' Column Names of SparkDataFrame
#'
-#' Return all column names as a list.
+#' Return a vector of column names.
#'
#' @param x a SparkDataFrame.
#'
@@ -338,7 +338,7 @@ setMethod("colnames",
})
#' @param value a character vector. Must have the same length as the number
-#' of columns in the SparkDataFrame.
+#' of columns to be renamed.
#' @rdname columns
#' @aliases colnames<-,SparkDataFrame-method
#' @name colnames<-
diff --git a/R/pkg/inst/tests/testthat/test_sparkSQL.R b/R/pkg/inst/tests/testthat/test_sparkSQL.R
index ce0f5a198a..1dd8c5ce6c 100644
--- a/R/pkg/inst/tests/testthat/test_sparkSQL.R
+++ b/R/pkg/inst/tests/testthat/test_sparkSQL.R
@@ -898,6 +898,12 @@ test_that("names() colnames() set the column names", {
expect_equal(names(z)[3], "c")
names(z)[3] <- "c2"
expect_equal(names(z)[3], "c2")
+
+ # Test subset assignment
+ colnames(df)[1] <- "col5"
+ expect_equal(colnames(df)[1], "col5")
+ names(df)[2] <- "col6"
+ expect_equal(names(df)[2], "col6")
})
test_that("head() and first() return the correct data", {