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

    https://github.com/apache/spark/pull/18458#discussion_r124706483
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -2156,28 +2178,23 @@ setMethod("date_format", signature(y = "Column", x 
= "character"),
                 column(jc)
               })
     
    -#' from_json
    -#'
    -#' Parses a column containing a JSON string into a Column of 
\code{structType} with the specified
    -#' \code{schema} or array of \code{structType} if \code{as.json.array} is 
set to \code{TRUE}.
    -#' If the string is unparseable, the Column will contains the value NA.
    +#' @details
    +#' \code{from_json}: Parses a column containing a JSON string into a 
Column of \code{structType}
    +#' with the specified \code{schema} or array of \code{structType} if 
\code{as.json.array} is set
    +#' to \code{TRUE}. If the string is unparseable, the Column will contains 
the value NA.
     #'
    -#' @param x Column containing the JSON string.
    +#' @rdname column_collection_functions
     #' @param schema a structType object to use as the schema to use when 
parsing the JSON string.
     #' @param as.json.array indicating if input string is JSON array of 
objects or a single object.
    -#' @param ... additional named properties to control how the json is 
parsed, accepts the same
    -#'            options as the JSON data source.
    -#'
    -#' @family non-aggregate functions
    -#' @rdname from_json
    -#' @name from_json
    -#' @aliases from_json,Column,structType-method
    +#' @aliases from_json from_json,Column,structType-method
     #' @export
     #' @examples
    +#'
     #' \dontrun{
    -#' schema <- structType(structField("name", "string"),
    -#' select(df, from_json(df$value, schema, dateFormat = "dd/MM/yyyy"))
    -#'}
    +#' df2 <- sql("SELECT named_struct('name', 'Bob') as people")
    +#' df2 <- mutate(df2, people_json = to_json(df2$people))
    +#' schema <- structType(structField("name", "string"))
    +#' head(select(df2, from_json(df2$people_json, schema)))}
    --- End diff --
    
    I think it's worthwhile to keep `dateFormat = "dd/MM/yyyy")` in the example


---
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]

Reply via email to