-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-18788][SPARKR] Add API for getNumPartitions #16668
Changes from all commits
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 |
---|---|---|
|
@@ -3406,3 +3406,26 @@ setMethod("randomSplit", | |
} | ||
sapply(sdfs, dataFrame) | ||
}) | ||
|
||
#' getNumPartitions | ||
#' | ||
#' Return the number of partitions | ||
#' | ||
#' @param x A SparkDataFrame | ||
#' @family SparkDataFrame functions | ||
#' @aliases getNumPartitions,SparkDataFrame-method | ||
#' @rdname getNumPartitions | ||
#' @name getNumPartitions | ||
#' @export | ||
#' @examples | ||
#'\dontrun{ | ||
#' sparkR.session() | ||
#' df <- createDataFrame(cars, numPartitions = 2) | ||
#' getNumPartitions(df) | ||
#' } | ||
#' @note getNumPartitions since 2.1.1 | ||
setMethod("getNumPartitions", | ||
signature(x = "SparkDataFrame"), | ||
function(x) { | ||
callJMethod(callJMethod(x@sdf, "rdd"), "getNumPartitions") | ||
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. One last thing - can we add a TODO and a pointer to a JIRA saying this needs to be fixed once getNumPartitions is added to scala API ? 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. so rxin is saying on #16708 that we don't want this to be a public API on Dataset. I'm leaving this for now since this implementation seems reasonably low overhead. perhaps @shivaram and @cloud-fan want to comment in #16708? |
||
}) |
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.
@felixcheung, should this be
since 2.2.0
? Just curious.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.
I debated about this quite a bit - generally it should but we merged createDataFrame(..., numPartitions) to 2.1 and it felt important to have a getNumPartition in the same release too.