diff options
author | gatorsmile <gatorsmile@gmail.com> | 2016-06-29 11:30:49 -0700 |
---|---|---|
committer | Shixiong Zhu <shixiong@databricks.com> | 2016-06-29 11:30:49 -0700 |
commit | 39f2eb1da34f26bf68c535c8e6b796d71a37a651 (patch) | |
tree | 0083493987d0d508779e0e011e719df3560ab788 | |
parent | 8c9cd0a7a719ce4286f77f35bb787e2b626a472e (diff) | |
download | spark-39f2eb1da34f26bf68c535c8e6b796d71a37a651.tar.gz spark-39f2eb1da34f26bf68c535c8e6b796d71a37a651.tar.bz2 spark-39f2eb1da34f26bf68c535c8e6b796d71a37a651.zip |
[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 <gatorsmile@gmail.com>
Closes #13965 from gatorsmile/optionPaths.
-rw-r--r-- | python/pyspark/sql/readwriter.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/python/pyspark/sql/readwriter.py b/python/pyspark/sql/readwriter.py index 10f307b987..44bf74476b 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))) |