Martin Grund, et al, announce a new preview feature in Databricks:\
To define the Python UDF, all you have to do is a
CREATE FUNCTION
SQL statement. This statement defines a function name, input parameters and types, specifies the language asPYTHON
, and provides the function body between $$.The function body of a Python UDF in Databricks SQL is equivalent to a regular Python function, with the UDF itself returning the computation’s final value. Dependencies from the Python standard library and Databricks Runtime 10.4, such as the json package in the above example, can be imported and used in your code. You can also define nested functions inside your UDF to encapsulate code to build or reuse complex logic.
I think my biggest concern here would be performance, though I say that without having used the feature.