aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/sql/readwriter.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/pyspark/sql/readwriter.py')
-rw-r--r--python/pyspark/sql/readwriter.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/python/pyspark/sql/readwriter.py b/python/pyspark/sql/readwriter.py
index 1678334889..6bed390e60 100644
--- a/python/pyspark/sql/readwriter.py
+++ b/python/pyspark/sql/readwriter.py
@@ -159,11 +159,12 @@ class DataFrameReader(OptionUtils):
allowComments=None, allowUnquotedFieldNames=None, allowSingleQuotes=None,
allowNumericLeadingZero=None, allowBackslashEscapingAnyCharacter=None,
mode=None, columnNameOfCorruptRecord=None, dateFormat=None, timestampFormat=None,
- timeZone=None):
+ timeZone=None, wholeFile=None):
"""
- Loads a JSON file (`JSON Lines text format or newline-delimited JSON
- <http://jsonlines.org/>`_) or an RDD of Strings storing JSON objects (one object per
- record) and returns the result as a :class`DataFrame`.
+ Loads a JSON file and returns the results as a :class:`DataFrame`.
+
+ Both JSON (one record per file) and `JSON Lines <http://jsonlines.org/>`_
+ (newline-delimited JSON) are supported and can be selected with the `wholeFile` parameter.
If the ``schema`` parameter is not specified, this function goes
through the input once to determine the input schema.
@@ -212,6 +213,8 @@ class DataFrameReader(OptionUtils):
default value, ``yyyy-MM-dd'T'HH:mm:ss.SSSZZ``.
:param timeZone: sets the string that indicates a timezone to be used to parse timestamps.
If None is set, it uses the default value, session local timezone.
+ :param wholeFile: parse one record, which may span multiple lines, per file. If None is
+ set, it uses the default value, ``false``.
>>> df1 = spark.read.json('python/test_support/sql/people.json')
>>> df1.dtypes
@@ -228,7 +231,7 @@ class DataFrameReader(OptionUtils):
allowSingleQuotes=allowSingleQuotes, allowNumericLeadingZero=allowNumericLeadingZero,
allowBackslashEscapingAnyCharacter=allowBackslashEscapingAnyCharacter,
mode=mode, columnNameOfCorruptRecord=columnNameOfCorruptRecord, dateFormat=dateFormat,
- timestampFormat=timestampFormat, timeZone=timeZone)
+ timestampFormat=timestampFormat, timeZone=timeZone, wholeFile=wholeFile)
if isinstance(path, basestring):
path = [path]
if type(path) == list: