pyspark.sql.Catalog.functionExists#

Catalog.functionExists(functionName, dbName=None)[source]#

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

Added in version 3.3.0.

Parameters:
functionNamestr

name of the function to check existence

Changed in version 3.4.0: Allow functionName to be qualified with catalog name

dbNamestr, optional

name of the database to check function existence in.

Returns:
bool

Indicating whether the function exists

Notes

If no database is specified, the current database and catalog are used. This API includes all temporary functions.

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