如果表当前缓存在内存中,则返回 true。
Syntax
isCached(tableName: str)
参数
| 参数 | 类型 | Description |
|---|---|---|
tableName |
str | 要获取的表的名称。 可以使用目录名称进行限定。 |
退货
bool
示例
_ = spark.sql("DROP TABLE IF EXISTS tbl1")
_ = spark.sql("CREATE TABLE tbl1 (name STRING, age INT) USING parquet")
spark.catalog.cacheTable("tbl1")
spark.catalog.isCached("tbl1")
# True
# Throw an analysis exception when the table does not exist.
spark.catalog.isCached("not_existing_table")
# Traceback (most recent call last):
# ...
# AnalysisException: ...
# Using the fully qualified name for the table.
spark.catalog.isCached("spark_catalog.default.tbl1")
# True
spark.catalog.uncacheTable("tbl1")
_ = spark.sql("DROP TABLE tbl1")