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

    https://github.com/apache/spark/pull/10145#discussion_r46726302
  
    --- Diff: R/pkg/R/SQLContext.R ---
    @@ -214,18 +214,45 @@ setMethod("toDF", signature(x = "RDD"),
     #' sc <- sparkR.init()
     #' sqlContext <- sparkRSQL.init(sc)
     #' path <- "path/to/file.json"
    -#' df <- jsonFile(sqlContext, path)
    +#' df <- read.json(sqlContext, path)
     #' }
     
    -jsonFile <- function(sqlContext, path) {
    +read.json <- function(sqlContext, ...) {
       # Allow the user to have a more flexible definiton of the text file path
    -  path <- suppressWarnings(normalizePath(path))
    +  paths <- if (length(list(...)) > 1) {
    +    lapply(list(...), function(x) suppressWarnings(normalizePath(x)))
    +  } else {
    +    as.list(suppressWarnings(normalizePath(splitString(...))))
    +  }
       # Convert a string vector of paths to a string containing comma 
separated paths
    -  path <- paste(path, collapse = ",")
    -  sdf <- callJMethod(sqlContext, "jsonFile", path)
    +  read <- callJMethod(sqlContext, "read")
    +  sdf <- callJMethod(read, "json", paths)
       dataFrame(sdf)
     }
     
    +#' Create a DataFrame from a JSON file.
    --- End diff --
    
    yes, see createDataFrame and as.DataFrame.
    They should have the same `@rdname` but distinct `@name`


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