You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/guides/54-query/03-udf.md
+70-3Lines changed: 70 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ FROM persons;
79
79
80
80
## Embedded UDFs
81
81
82
-
Embedded UDFs allow you to write functions using full programming languages, giving you more flexibility and power than Lambda UDFs.
82
+
AKA Script UDFs, Embedded UDFs allow you to write functions using full programming languages, giving you more flexibility and power than Lambda UDFs.
83
83
84
84
### Supported Languages
85
85
@@ -93,7 +93,10 @@ Embedded UDFs allow you to write functions using full programming languages, giv
93
93
```sql
94
94
CREATE [OR REPLACE] FUNCTION <function_name>([<parameter_type>, ...])
95
95
RETURNS <return_type>
96
-
LANGUAGE <language_name> HANDLER ='<handler_name>'
96
+
LANGUAGE <language_name>
97
+
(IMPORTS = ("<import_path>", ...))
98
+
(PACKAGES = ("<package_path>", ...))
99
+
HANDLER ='<handler_name>'
97
100
AS $$
98
101
<function_code>
99
102
$$;
@@ -107,6 +110,8 @@ $$;
107
110
|`parameter_type`| Data type of each input parameter |
108
111
|`return_type`| Data type of the function's return value |
109
112
|`language_name`| Programming language (python or javascript) |
113
+
|`imports`| List of stage files, such as `@s_udf/your_file.zip`, files will be downloaded from stage into path `sys._xoptions['databend_import_directory']`, you can read it and unzip it in your python codes |
114
+
|`packages`| List of packages to be installed from pypi, such as `numpy`, `pandas` etc. |
110
115
|`handler_name`| Name of the function in the code that will be called |
111
116
|`function_code`| The actual code implementing the function |
112
117
@@ -165,6 +170,68 @@ SELECT calculate_age_py('1990-05-15') AS age_result;
0 commit comments