Databricks - Creating permanent User Defined Functions (UDFs)

穿精又带淫゛_ 提交于 2019-12-01 13:47:15

This is not possible; this is not like UDFs in Hive.

Code the UDF as part of the package / program you submit or in the jar included in the Spark App, if using spark-submit.

However,

spark.udf.register.udf("...

is required to be done as well. This applies to Databrick notebooks, etc. The UDFs need to be re-registered per Spark Context/Session.

acutally you can create a permanent function but not from a notebook you need to create it from a JAR file

https://docs.databricks.com/spark/latest/spark-sql/language-manual/create-function.html

CREATE [TEMPORARY] FUNCTION [db_name.]function_name AS class_name [USING resource, ...]

resource: : (JAR|FILE|ARCHIVE) file_uri

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!