Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions R/pkg/R/DataFrame.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#'
Expand Down Expand Up @@ -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<-
Expand Down
6 changes: 6 additions & 0 deletions R/pkg/inst/tests/testthat/test_sparkSQL.R
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down