pyspark.sql.Catalog.functionExists

Catalog.functionExists(functionName: str, dbName: Optional[str] = None) → bool

Check if the function with the specified name exists. This can either be a temporary function or a function.

Parameters
functionNamestr

name of the function to check existence

dbNamestr, optional

name of the database to check function existence in. If no database is specified, the current database is used

Returns
bool

Indicating whether the function exists

Allowed functionName to be qualified with catalog name

Examples

>>> spark.catalog.functionExists("unexisting_function")
False
>>> spark.catalog.functionExists("default.unexisting_function")
False
>>> spark.catalog.functionExists("spark_catalog.default.unexisting_function")
False