-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25117][R] Add EXEPT ALL and INTERSECT ALL support in R #22107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
6076700
426ffed
7e88c9d
5247ab5
1d93304
528050d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2848,6 +2848,35 @@ setMethod("intersect", | |
| dataFrame(intersected) | ||
| }) | ||
|
|
||
| #' intersectAll | ||
| #' | ||
| #' Return a new SparkDataFrame containing rows in both this SparkDataFrame | ||
| #' and another SparkDataFrame while preserving the duplicates. | ||
| #' This is equivalent to \code{INTERSECT ALL} in SQL. Also as standard in | ||
| #' SQL, this function resolves columns by position (not by name). | ||
| #' | ||
| #' @param x a SparkDataFrame. | ||
| #' @param y a SparkDataFrame. | ||
| #' @return A SparkDataFrame containing the result of the intersect all operation. | ||
| #' @family SparkDataFrame functions | ||
| #' @aliases intersectAll,SparkDataFrame,SparkDataFrame-method | ||
| #' @rdname intersectAll | ||
| #' @name intersectAll | ||
| #' @examples | ||
| #'\dontrun{ | ||
| #' sparkR.session() | ||
| #' df1 <- read.json(path) | ||
| #' df2 <- read.json(path2) | ||
| #' intersectAllDF <- intersectAll(df1, df2) | ||
| #' } | ||
| #' @rdname intersectAll | ||
| #' @note intersectAll since 2.4.0 | ||
| setMethod("intersectAll", | ||
| signature(x = "SparkDataFrame", y = "SparkDataFrame"), | ||
| function(x, y) { | ||
| intersected <- callJMethod(x@sdf, "intersectAll", y@sdf) | ||
| dataFrame(intersected) | ||
| }) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add extra empty line after code
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @felixcheung OK. |
||
| #' except | ||
| #' | ||
| #' Return a new SparkDataFrame containing rows in this SparkDataFrame | ||
|
|
@@ -2876,6 +2905,37 @@ setMethod("except", | |
| dataFrame(excepted) | ||
| }) | ||
|
|
||
| #' exceptAll | ||
| #' | ||
| #' Return a new SparkDataFrame containing rows in this SparkDataFrame | ||
| #' but not in another SparkDataFrame while preserving the duplicates. | ||
| #' This is equivalent to \code{EXCEPT ALL} in SQL. Also as standard in | ||
| #' SQL, this function resolves columns by position (not by name). | ||
| #' | ||
| #' @param x a SparkDataFrame. | ||
| #' @param y a SparkDataFrame. | ||
| #' @return A SparkDataFrame containing the result of the except all operation. | ||
| #' @family SparkDataFrame functions | ||
| #' @aliases exceptAll,SparkDataFrame,SparkDataFrame-method | ||
| #' @rdname exceptAll | ||
| #' @name exceptAll | ||
| #' @examples | ||
| #'\dontrun{ | ||
| #' sparkR.session() | ||
| #' df1 <- read.json(path) | ||
| #' df2 <- read.json(path2) | ||
| #' exceptAllDF <- exceptAll(df1, df2) | ||
| #' } | ||
| #' @rdname exceptAll | ||
|
||
| #' @note exceptAll since 2.4.0 | ||
| setMethod("exceptAll", | ||
| signature(x = "SparkDataFrame", y = "SparkDataFrame"), | ||
| function(x, y) { | ||
| excepted <- callJMethod(x@sdf, "exceptAll", y@sdf) | ||
| dataFrame(excepted) | ||
| }) | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: remove one of the two empty lines
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @felixcheung Sure. |
||
|
|
||
| #' Save the contents of SparkDataFrame to a data source. | ||
| #' | ||
| #' The data source is specified by the \code{source} and a set of options (...). | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto here