diff options
author | zero323 <zero323@users.noreply.github.com> | 2017-04-21 12:06:21 -0700 |
---|---|---|
committer | Felix Cheung <felixcheung@apache.org> | 2017-04-21 12:06:21 -0700 |
commit | fd648bff63f91a30810910dfc5664eea0ff5e6f9 (patch) | |
tree | f00aacc693efa151d857684b3cb0907ce74fd775 /R/pkg/R/functions.R | |
parent | eb00378f0eed6afbf328ae6cd541cc202d14c1f0 (diff) | |
download | spark-fd648bff63f91a30810910dfc5664eea0ff5e6f9.tar.gz spark-fd648bff63f91a30810910dfc5664eea0ff5e6f9.tar.bz2 spark-fd648bff63f91a30810910dfc5664eea0ff5e6f9.zip |
[SPARK-20371][R] Add wrappers for collect_list and collect_set
## What changes were proposed in this pull request?
Adds wrappers for `collect_list` and `collect_set`.
## How was this patch tested?
Unit tests, `check-cran.sh`
Author: zero323 <zero323@users.noreply.github.com>
Closes #17672 from zero323/SPARK-20371.
Diffstat (limited to 'R/pkg/R/functions.R')
-rw-r--r-- | R/pkg/R/functions.R | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R index f854df11e5..e7decb9186 100644 --- a/R/pkg/R/functions.R +++ b/R/pkg/R/functions.R @@ -3705,3 +3705,43 @@ setMethod("create_map", jc <- callJStatic("org.apache.spark.sql.functions", "map", jcols) column(jc) }) + +#' collect_list +#' +#' Creates a list of objects with duplicates. +#' +#' @param x Column to compute on +#' +#' @rdname collect_list +#' @name collect_list +#' @family agg_funcs +#' @aliases collect_list,Column-method +#' @export +#' @examples \dontrun{collect_list(df$x)} +#' @note collect_list since 2.3.0 +setMethod("collect_list", + signature(x = "Column"), + function(x) { + jc <- callJStatic("org.apache.spark.sql.functions", "collect_list", x@jc) + column(jc) + }) + +#' collect_set +#' +#' Creates a list of objects with duplicate elements eliminated. +#' +#' @param x Column to compute on +#' +#' @rdname collect_set +#' @name collect_set +#' @family agg_funcs +#' @aliases collect_set,Column-method +#' @export +#' @examples \dontrun{collect_set(df$x)} +#' @note collect_set since 2.3.0 +setMethod("collect_set", + signature(x = "Column"), + function(x) { + jc <- callJStatic("org.apache.spark.sql.functions", "collect_set", x@jc) + column(jc) + }) |