pyspark.sql.streaming.DataStreamReader.orc#

DataStreamReader.orc(path, mergeSchema=None, pathGlobFilter=None, recursiveFileLookup=None)[source]#

Loads a ORC file stream, returning the result as a DataFrame.

New in version 2.3.0.

Changed in version 3.5.0: Supports Spark Connect.

Other Parameters
Extra options

For the extra options, refer to Data Source Option in the version you use.

Examples

Load a data stream from a temporary ORC file.

>>> import tempfile
>>> import time
>>> with tempfile.TemporaryDirectory(prefix="orc") as d:
...     # Write a temporary ORC file to read it.
...     spark.range(10).write.mode("overwrite").format("orc").save(d)
...
...     # Start a streaming query to read the ORC file.
...     q = spark.readStream.schema("id LONG").orc(d).writeStream.format("console").start()
...     time.sleep(3)
...     q.stop()