functionExists

檢查指定名稱的函式是否存在。 這可以是暫時函數或函數。

語法

functionExists(functionName: str, dbName: str = None)

參數

參數 類型 說明
functionName str 用來檢查存在性的函式名稱。 可以用目錄名稱來限定。
dbName 力量,選用 資料庫名稱,用來檢查函式的存在。

退貨

bool

以表示該函數是否存在。

Notes

若未指定資料庫,則使用目前的資料庫與目錄。 此 API 包含所有暫存函式。

Examples

spark.catalog.functionExists("count")
# True

# Using the fully qualified name for function name.
spark.catalog.functionExists("default.unexisting_function")
# False
spark.catalog.functionExists("spark_catalog.default.unexisting_function")
# False