Skip to main content

functionExists

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

Syntax

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

Parameters

Parameter

Type

Description

functionName

str

Name of the function to check existence. Can be qualified with catalog name.

dbName

str, 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

Python
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