You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by fe...@apache.org on 2016/10/23 17:53:33 UTC
spark git commit: [SPARKR][BRANCH-2.0] R merge API doc and example fix
Repository: spark
Updated Branches:
refs/heads/branch-2.0 e21e9d416 -> 0e0d83a59
[SPARKR][BRANCH-2.0] R merge API doc and example fix
## What changes were proposed in this pull request?
Fixes for R doc
## How was this patch tested?
N/A
Author: Felix Cheung <fe...@hotmail.com>
Closes #15589 from felixcheung/rdocmergefix.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/0e0d83a5
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/0e0d83a5
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/0e0d83a5
Branch: refs/heads/branch-2.0
Commit: 0e0d83a597885ab1773cb69d6dcc10346d6976a3
Parents: e21e9d4
Author: Felix Cheung <fe...@hotmail.com>
Authored: Sun Oct 23 10:53:27 2016 -0700
Committer: Felix Cheung <fe...@apache.org>
Committed: Sun Oct 23 10:53:27 2016 -0700
----------------------------------------------------------------------
R/pkg/R/DataFrame.R | 7 +++++--
R/pkg/inst/tests/testthat/test_sparkSQL.R | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/0e0d83a5/R/pkg/R/DataFrame.R
----------------------------------------------------------------------
diff --git a/R/pkg/R/DataFrame.R b/R/pkg/R/DataFrame.R
index a5bd603..d5c5486 100644
--- a/R/pkg/R/DataFrame.R
+++ b/R/pkg/R/DataFrame.R
@@ -345,7 +345,7 @@ setMethod("colnames<-",
# Check if the column names have . in it
if (any(regexec(".", value, fixed = TRUE)[[1]][1] != -1)) {
- stop("Colum names cannot contain the '.' symbol.")
+ stop("Column names cannot contain the '.' symbol.")
}
sdf <- callJMethod(x@sdf, "toDF", as.list(value))
@@ -2297,6 +2297,8 @@ setMethod("join",
#' @param y the second data frame to be joined
#' @param by a character vector specifying the join columns. If by is not
#' specified, the common column names in \code{x} and \code{y} will be used.
+#' If by or both by.x and by.y are explicitly set to NULL or of length 0, the Cartesian
+#' Product of x and y will be returned.
#' @param by.x a character vector specifying the joining columns for x.
#' @param by.y a character vector specifying the joining columns for y.
#' @param all a boolean value setting \code{all.x} and \code{all.y}
@@ -2326,13 +2328,14 @@ setMethod("join",
#' sparkR.session()
#' df1 <- read.json(path)
#' df2 <- read.json(path2)
-#' merge(df1, df2) # Performs a Cartesian
+#' merge(df1, df2) # Performs an inner join by common columns
#' merge(df1, df2, by = "col1") # Performs an inner join based on expression
#' merge(df1, df2, by.x = "col1", by.y = "col2", all.y = TRUE)
#' merge(df1, df2, by.x = "col1", by.y = "col2", all.x = TRUE)
#' merge(df1, df2, by.x = "col1", by.y = "col2", all.x = TRUE, all.y = TRUE)
#' merge(df1, df2, by.x = "col1", by.y = "col2", all = TRUE, sort = FALSE)
#' merge(df1, df2, by = "col1", all = TRUE, suffixes = c("-X", "-Y"))
+#' merge(df1, df2, by = NULL) # Performs a Cartesian join
#' }
#' @note merge since 1.5.0
setMethod("merge",
http://git-wip-us.apache.org/repos/asf/spark/blob/0e0d83a5/R/pkg/inst/tests/testthat/test_sparkSQL.R
----------------------------------------------------------------------
diff --git a/R/pkg/inst/tests/testthat/test_sparkSQL.R b/R/pkg/inst/tests/testthat/test_sparkSQL.R
index b7b9de7..ef6cab1 100644
--- a/R/pkg/inst/tests/testthat/test_sparkSQL.R
+++ b/R/pkg/inst/tests/testthat/test_sparkSQL.R
@@ -815,7 +815,7 @@ test_that("names() colnames() set the column names", {
expect_equal(names(df)[1], "col3")
expect_error(colnames(df) <- c("sepal.length", "sepal_width"),
- "Colum names cannot contain the '.' symbol.")
+ "Column names cannot contain the '.' symbol.")
expect_error(colnames(df) <- c(1, 2), "Invalid column names.")
expect_error(colnames(df) <- c("a"),
"Column names must have the same length as the number of columns in the dataset.")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org