Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/12887#discussion_r61990844
--- Diff: R/pkg/R/DataFrame.R ---
@@ -594,6 +594,35 @@ setMethod("repartition",
dataFrame(sdf)
})
+#' RepartitionByColumn
+#'
+#' Return a new SparkDataFrame which has as many partitions as the number
of unique
+#' groups identified by column(s) values which are being specified by the
input.
+#'
+#' @param x A SparkDataFrame
+#' @param col The column by which the partitioning will be performed
+#'
+#' @family SparkDataFrame functions
+#' @rdname repartition
+#' @name repartition
+#' @export
+#' @examples
+#'\dontrun{
+#' sc <- sparkR.init()
+#' sqlContext <- sparkRSQL.init(sc)
+#' path <- "path/to/file.json"
+#' df <- read.json(sqlContext, path)
+#' newDF <- repartitionByColumn(df, df$col1, df$col2)
+#'}
+setMethod("repartitionByColumn",
--- End diff --
Basically you would need to remove that from the signature line and add
default value in the function line, something like:
```
setMethod("repartition",
signature(x = "SparkDataFrame"),
function(x, numPartitions = NULL, col = NULL)
```
and then check for which one of numPartitions or col is set, that they are
the right type (since types are not specified now in the signature), and that
they are not both set and so on.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]