orc (DataFrameReader)
Loads ORC files and returns the result as a DataFrame.
Syntax
orc(path, **options)
Parameters
Parameter | Type | Description |
|---|---|---|
| str or list | One or more input paths. |
Returns
DataFrame
Examples
Write a DataFrame into an ORC file and read it back.
Python
import tempfile
with tempfile.TemporaryDirectory(prefix="orc") as d:
spark.createDataFrame(
[{"age": 100, "name": "Alice"}]
).write.mode("overwrite").format("orc").save(d)
spark.read.orc(d).show()
# +---+------------+
# |age| name|
# +---+------------+
# |100|Alice|
# +---+------------+