Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/16609#discussion_r97192721
--- Diff: R/pkg/R/DataFrame.R ---
@@ -78,6 +78,55 @@ dataFrame <- function(sdf, isCached = FALSE) {
############################ SparkDataFrame Methods
##############################################
+#' storageName
+#'
+#' Return a SparkDataFrame's name.
+#'
+#' @param x The SparkDataFrame whose name is returned.
+#' @family SparkDataFrame functions
+#' @rdname storageName
+#' @examples
+#'\dontrun{
+#' sparkR.session()
+#' path <- "path/to/file.json"
+#' df <- read.json(path)
+#' storageName(df)
+#'}
+#' @aliases storageName,SparkDataFrame-method
+#' @export
+#' @note name since 2.2.0
+setMethod("storageName",
+ signature(x = "SparkDataFrame"),
+ function(x) {
+ callJMethod(x@sdf, "name")
+ })
+
+#' storageName
+#'
+#' Set a SparkDataFrame's name. This will be displayed on the Storage tab
in the UI if cached.
+#'
+#' @param x The SparkDataFrame whose name is to be set.
+#' @param name The SparkDataFrame name to be set.
+#' @family SparkDataFrame functions
+#' @return the SparkDataFrame renamed.
+#' @rdname storageName
+#' @examples
+#'\dontrun{
+#' sparkR.session()
+#' path <- "path/to/file.json"
+#' df <- read.json(path)
+#' storageName(df) <- "foo"
+#'}
+#' @aliases name<-,SparkDataFrame-method
+#' @export
+#' @note name<- since 2.2.0
+setMethod("storageName<-",
+ signature(x = "SparkDataFrame", name = "character"),
+ function(x, name) {
+ callJMethod(x@sdf, "setName", name)
+ x
--- End diff --
for the setter (`something<-`) you have the make the first parameter
`value` (change this from `name` you have here)
---
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]