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

    https://github.com/apache/spark/pull/15239#discussion_r82355751
  
    --- Diff: R/pkg/R/SQLContext.R ---
    @@ -341,11 +342,13 @@ setMethod("toDF", signature(x = "RDD"),
     #' @name read.json
     #' @method read.json default
     #' @note read.json since 1.6.0
    -read.json.default <- function(path) {
    +read.json.default <- function(path, ...) {
       sparkSession <- getSparkSession()
    +  options <- varargsToStrEnv(...)
       # Allow the user to have a more flexible definiton of the text file path
       paths <- as.list(suppressWarnings(normalizePath(path)))
       read <- callJMethod(sparkSession, "read")
    +  read <- callJMethod(read, "options", options)
    --- End diff --
    
    Oh, I haven't tested this yet but the first `path` will have higher 
precedence because in `setWriteOptions`,
    
    ```
    options <- varargsToStrEnv(...)
    if (!is.null(path)) {
      options[["path"]] <- path
    }
    ```
    
    We are setting the first `path` later overwriting the existing path.
    
    It seems this way is the same in Scala as well.
    
    ```
      def load(path: String): DataFrame = {
        option("path", path).load(Seq.empty: _*) // force invocation of 
`load(...varargs...)`
      }
    ```
    
    It overwrites the path in the `option` when it actually loads. Let me test 
this and leave another comment in R.
    



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