הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Get the function with the specified name. This function can be a temporary function or a function. This throws an AnalysisException when the function cannot be found.
Syntax
getFunction(functionName: str)
Parameters
| Parameter | Type | Description |
|---|---|---|
functionName |
str | Name of the function to get. |
Returns
Function
The function found by the name.
Examples
_ = spark.sql(
"CREATE FUNCTION my_func1 AS 'test.org.apache.spark.sql.MyDoubleAvg'")
spark.catalog.getFunction("my_func1")
# Function(name='my_func1', catalog='spark_catalog', namespace=['default'], ...
# Using the fully qualified name for function name.
spark.catalog.getFunction("default.my_func1")
# Function(name='my_func1', catalog='spark_catalog', namespace=['default'], ...
spark.catalog.getFunction("spark_catalog.default.my_func1")
# Function(name='my_func1', catalog='spark_catalog', namespace=['default'], ...
# Throw an analysis exception when the function does not exist.
spark.catalog.getFunction("my_func2")
# Traceback (most recent call last):
# ...
# AnalysisException: ...