回傳指定的資料表為 DataFrame。
語法
table(tableName)
參數
| 參數 | 類型 | 說明 |
|---|---|---|
tableName |
str | 要取回的表格名稱。 |
退貨
DataFrame
Notes
在 Spark Classic 中,參考的 spark.table 臨時視圖會立即解決。 在 Spark Connect 中,分析較為緩慢,因此若在 之後 spark.table丟棄、修改或替換視圖,執行可能會失敗或產生不同結果。
Examples
spark.range(5).createOrReplaceTempView("table1")
spark.table("table1").sort("id").show()
# +---+
# | id|
# +---+
# | 0|
# | 1|
# | 2|
# | 3|
# | 4|
# +---+