Repository: spark
Updated Branches:
refs/heads/master 8c9cd0a7a -> 39f2eb1da
[SPARK-16236][SQL][FOLLOWUP] Add Path Option back to Load API in DataFrameReader
#### What changes were proposed in this pull request?
In Python API, we have the same issue. Thanks for identifying this issue,
zsxwing ! Below is an example:
```Python
spark.read.format('json').load('python/test_support/sql/people.json')
```
#### How was this patch tested?
Existing test cases cover the changes by this PR
Author: gatorsmile <[email protected]>
Closes #13965 from gatorsmile/optionPaths.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/39f2eb1d
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/39f2eb1d
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/39f2eb1d
Branch: refs/heads/master
Commit: 39f2eb1da34f26bf68c535c8e6b796d71a37a651
Parents: 8c9cd0a
Author: gatorsmile <[email protected]>
Authored: Wed Jun 29 11:30:49 2016 -0700
Committer: Shixiong Zhu <[email protected]>
Committed: Wed Jun 29 11:30:49 2016 -0700
----------------------------------------------------------------------
python/pyspark/sql/readwriter.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/39f2eb1d/python/pyspark/sql/readwriter.py
----------------------------------------------------------------------
diff --git a/python/pyspark/sql/readwriter.py b/python/pyspark/sql/readwriter.py
index 10f307b..44bf744 100644
--- a/python/pyspark/sql/readwriter.py
+++ b/python/pyspark/sql/readwriter.py
@@ -143,7 +143,9 @@ class DataFrameReader(OptionUtils):
if schema is not None:
self.schema(schema)
self.options(**options)
- if path is not None:
+ if isinstance(path, basestring):
+ return self._df(self._jreader.load(path))
+ elif path is not None:
if type(path) != list:
path = [path]
return
self._df(self._jreader.load(self._spark._sc._jvm.PythonUtils.toSeq(path)))
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]