diff options
author | hyukjinkwon <gurwls223@gmail.com> | 2016-10-18 13:49:02 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2016-10-18 13:49:02 -0700 |
commit | b3130c7b6a1ab4975023f08c3ab02ee8d2c7e995 (patch) | |
tree | 03acda74287641ffa5fc753c89fe7746bc2dc007 /dev/deps | |
parent | 4518642abd71bb1213a9efd72732102abf0bf7e7 (diff) | |
download | spark-b3130c7b6a1ab4975023f08c3ab02ee8d2c7e995.tar.gz spark-b3130c7b6a1ab4975023f08c3ab02ee8d2c7e995.tar.bz2 spark-b3130c7b6a1ab4975023f08c3ab02ee8d2c7e995.zip |
[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.
```diff
- 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.
Author: hyukjinkwon <gurwls223@gmail.com>
Closes #15499 from HyukjinKwon/SPARK-17955.
Diffstat (limited to 'dev/deps')
0 files changed, 0 insertions, 0 deletions