GitHub user HyukjinKwon opened a pull request:

    https://github.com/apache/spark/pull/15499

    [SPARK-17955][SQL] Make DataFrameReader.jdbc call 
DataFrameReader.format("jdbc").load

    ## What changes were proposed in this pull request?
    
    This PR proposes to make `DataFrameReader.jdbc` call 
`DataFrameReader.format("jdbc").load` consistently with other APIs in 
`DataFrameReader`/`DataFrameWriter` and avoid calling 
`sparkSession.baseRelationToDataFrame(..)` here and there.
    
    The changes were mostly copied from `DataFrameWriter.jdbc()` which was 
recently updated.
    
    ```
    -    val params = extraOptions.toMap ++ connectionProperties.asScala.toMap
    -    val options = new JDBCOptions(url, table, params)
    -    val relation = JDBCRelation(parts, options)(sparkSession)
    -    sparkSession.baseRelationToDataFrame(relation)
    +    this.extraOptions = this.extraOptions ++ connectionProperties.asScala
    +    // explicit url and dbtable should override all
    +    this.extraOptions += ("url" -> url, "dbtable" -> table)
    +    format("jdbc").load()
    ```
    
    ## How was this patch tested?
    
    Existing tests should cover this.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HyukjinKwon/spark SPARK-17955

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/15499.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #15499
    
----
commit aa8cd3507d6ae79c0b2c93a077e655880d10a01c
Author: hyukjinkwon <gurwls...@gmail.com>
Date:   2016-10-15T12:36:01Z

    Use the same read path in DataFrameReader.jdbc and 
DataFrameReader.format("jdbc")

commit 0d6e2d1aa6a3348c4fad5256b7580364499d3daf
Author: hyukjinkwon <gurwls...@gmail.com>
Date:   2016-10-15T12:39:11Z

    Add missing dots

----


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