text(path, wholetext=False, lineSep=None, pathGlobFilter=None, recursiveFileLookup=None)¶
Loads a text file stream and returns a
DataFramewhose schema starts with a string column named “value”, and followed by partitioned columns if there are any. The text files must be encoded as UTF-8.
By default, each line in the text file is a new row in the resulting DataFrame.
New in version 2.0.0.
- pathsstr or list
string, or list of strings, for input path(s).
- Other Parameters
- Extra options
For the extra options, refer to Data Source Option in the version you use.
This API is evolving.
>>> text_sdf = spark.readStream.text(tempfile.mkdtemp()) >>> text_sdf.isStreaming True >>> "value" in str(text_sdf.schema) True