Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 23553200B33 for ; Wed, 29 Jun 2016 20:30:55 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 21DFF160A57; Wed, 29 Jun 2016 18:30:55 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 67BC9160A3C for ; Wed, 29 Jun 2016 20:30:54 +0200 (CEST) Received: (qmail 25026 invoked by uid 500); 29 Jun 2016 18:30:53 -0000 Mailing-List: contact commits-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@spark.apache.org Received: (qmail 25017 invoked by uid 99); 29 Jun 2016 18:30:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jun 2016 18:30:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4D02BE5CE1; Wed, 29 Jun 2016 18:30:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zsxwing@apache.org To: commits@spark.apache.org Message-Id: <5c687079ffb74c69b11b23e76824147e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: spark git commit: [SPARK-16236][SQL][FOLLOWUP] Add Path Option back to Load API in DataFrameReader Date: Wed, 29 Jun 2016 18:30:53 +0000 (UTC) archived-at: Wed, 29 Jun 2016 18:30:55 -0000 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 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 Authored: Wed Jun 29 11:30:49 2016 -0700 Committer: Shixiong Zhu 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: commits-unsubscribe@spark.apache.org For additional commands, e-mail: commits-help@spark.apache.org