加载 ORC 文件并返回结果作为 DataFrame.
Syntax
orc(path, **options)
参数
| 参数 | 类型 | 说明 |
|---|---|---|
path |
str 或 list | 一个或多个输入路径。 |
退货
DataFrame
示例
将数据帧写入 ORC 文件,并将其读回。
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|
# +---+------------+