You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by shivaram <gi...@git.apache.org> on 2016/05/06 01:55:38 UTC

[GitHub] spark pull request: [SPARK-12919][SPARKR] Implement dapply() on Da...

Github user shivaram commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12493#discussion_r62281013
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -1125,6 +1126,66 @@ setMethod("summarize",
                 agg(x, ...)
               })
     
    +#' dapply
    +#'
    +#' Apply a function to each partition of a DataFrame.
    +#'
    +#' @param x A SparkDataFrame
    +#' @param func A function to be applied to each partition of the SparkDataFrame.
    +#'             func should have only one parameter, to which a data.frame corresponds
    +#'             to each partition will be passed.
    +#'             The output of func should be a data.frame.
    +#' @param schema The schema of the resulting DataFrame after the function is applied.
    +#'               It must match the output of func.
    +#' @family SparkDataFrame functions
    +#' @rdname dapply
    +#' @name dapply
    +#' @export
    +#' @examples
    +#' \dontrun{
    +#'   df <- createDataFrame (sqlContext, iris)
    +#'   df1 <- dapply(df, function(x) { x }, schema(df))
    +#'   collect(df1)
    +#'
    +#'   # filter and add a column
    +#'   df <- createDataFrame (
    +#'           sqlContext, 
    +#'           list(list(1L, 1, "1"), list(2L, 2, "2"), list(3L, 3, "3")),
    +#'           c("a", "b", "c"))
    +#'   schema <- structType(structField("a", "integer"), structField("b", "double"),
    --- End diff --
    
    @sun-rui - Just a note that it'll be great to have the simpler schema specification for 2.0. Let me know if you have a new JIRA or we will use 11046, so we can track it for the release.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org