Github user sun-rui commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10480#discussion_r48517423
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -2272,3 +2260,40 @@ setMethod("with",
                 newEnv <- assignNewEnv(data)
                 eval(substitute(expr), envir = newEnv, enclos = newEnv)
               })
    +
    +#' Saves the content of the DataFrame to an external database table via 
JDBC
    +#'
    +#' Additional JDBC database connection properties can be set (...)
    +#'
    +#' Also, mode is used to specify the behavior of the save operation when
    +#' data already exists in the data source. There are four modes: \cr
    +#'  append: Contents of this DataFrame are expected to be appended to 
existing data. \cr
    +#'  overwrite: Existing data is expected to be overwritten by the contents 
of this DataFrame. \cr
    +#'  error: An exception is expected to be thrown. \cr
    +#'  ignore: The save operation is expected to not save the contents of the 
DataFrame
    +#'     and to not change the existing data. \cr
    +#'
    +#' @param x A SparkSQL DataFrame
    +#' @param url JDBC database url of the form `jdbc:subprotocol:subname`
    +#' @param tableName The name of the table in the external database
    +#' @param mode One of 'append', 'overwrite', 'error', 'ignore' save mode 
(it is 'error' by default)
    +#' @family DataFrame functions
    +#' @rdname write.jdbc
    +#' @name write.jdbc
    +#' @export
    +#' @examples
    +#'\dontrun{
    +#' sc <- sparkR.init()
    +#' sqlContext <- sparkRSQL.init(sc)
    +#' jdbcUrl <- "jdbc:mysql://localhost:3306/databasename"
    +#' write.jdbc(df, jdbcUrl, "table", user = "username", password = 
"password")
    +#' }
    +setMethod("write.jdbc",
    +          signature(x = "DataFrame", url = "character", tableName = 
"character"),
    +          function(x, url, tableName, mode = "error", ...){
    +            jmode <- convertToJSaveMode(mode)
    +            jprops <- envToJProperties(varargsToEnv(...))
    --- End diff --
    
    vararg -> env -> properties seems a little redundant. I would prefer vararg 
-> properties.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to