Repository: spark Updated Branches: refs/heads/master bc1e10103 -> e7adb7d7a
[SPARK-22437][PYSPARK] default mode for jdbc is wrongly set to None ## What changes were proposed in this pull request? When writing using jdbc with python currently we are wrongly assigning by default None as writing mode. This is due to wrongly calling mode on the `_jwrite` object instead of `self` and it causes an exception. ## How was this patch tested? manual tests Author: Marco Gaido <[email protected]> Closes #19654 from mgaido91/SPARK-22437. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e7adb7d7 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e7adb7d7 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e7adb7d7 Branch: refs/heads/master Commit: e7adb7d7a6d017bb95da566e76b39d9d96ab42c1 Parents: bc1e101 Author: Marco Gaido <[email protected]> Authored: Sat Nov 4 16:59:58 2017 +0900 Committer: hyukjinkwon <[email protected]> Committed: Sat Nov 4 16:59:58 2017 +0900 ---------------------------------------------------------------------- python/pyspark/sql/readwriter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/e7adb7d7/python/pyspark/sql/readwriter.py ---------------------------------------------------------------------- diff --git a/python/pyspark/sql/readwriter.py b/python/pyspark/sql/readwriter.py index f309291..3d87567 100644 --- a/python/pyspark/sql/readwriter.py +++ b/python/pyspark/sql/readwriter.py @@ -915,7 +915,7 @@ class DataFrameWriter(OptionUtils): jprop = JavaClass("java.util.Properties", self._spark._sc._gateway._gateway_client)() for k in properties: jprop.setProperty(k, properties[k]) - self._jwrite.mode(mode).jdbc(url, table, jprop) + self.mode(mode)._jwrite.jdbc(url, table, jprop) def _test(): --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
