GitHub user HyukjinKwon opened a pull request:

    [SPARK-17955][SQL] Make DataFrameReader.jdbc call 

    ## 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 SPARK-17955

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

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 <>
Date:   2016-10-15T12:36:01Z

    Use the same read path in DataFrameReader.jdbc and 

commit 0d6e2d1aa6a3348c4fad5256b7580364499d3daf
Author: hyukjinkwon <>
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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to