載入 ORC 檔案並以 DataFrame.
語法
orc(path, **options)
參數
| 參數 | 類型 | 說明 |
|---|---|---|
path |
力量或列表 | 一條或多條輸入路徑。 |
退貨
DataFrame
Examples
將 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|
# +---+------------+