-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding the guide for using RisingWave UDF API for Python #689
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
LANGUAGE python AS series USING LINK 'http://localhost:8815'; | ||
``` | ||
|
||
## 5. Use your functions in RisingWave |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wangrunji0408 Can you provide known limitations for creating/using UDFs in RIsingWave at this stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ARRAY
andJSONB
types are not supported now. We will add them soon.- For
STRUCT
types, field names must be consistent between Python and SQL definitions. Otherwise it will be considered a type mismatch. This requirement may be relaxed in the future.
@@ -310,6 +310,10 @@ const sidebars = { | |||
id: 'sql/query-syntax/query-syntax-with-clause', | |||
label: 'WITH', | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hengm3467 Should I add (a link to) CREATE FUNCTION to the sidebar under SQL - Commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CharlieSYH Yes. Let's do that. And point to the new guide. This ensures findability via both self-navigation and search.
|
||
## Prerequisites | ||
|
||
- Ensure that you have [Python](https://www.python.org/downloads/) installed on your computer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention that the minimum supported version is Python 3.8.
| **RETURNS** *return_type* | Specifies the data type of the return value from the UDF. | | ||
| **RETURNS TABLE** | Specifies the structure of the table that the UDF returns. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention that the former is for scalar functions and the latter is for table functions. User should use either of them.
LANGUAGE python AS series USING LINK 'http://localhost:8815'; | ||
``` | ||
|
||
## 5. Use your functions in RisingWave |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ARRAY
andJSONB
types are not supported now. We will add them soon.- For
STRUCT
types, field names must be consistent between Python and SQL definitions. Otherwise it will be considered a type mismatch. This requirement may be relaxed in the future.
Co-authored-by: Runji Wang <wangrunji0408@163.com>
description: Define your own functions with the help of the RisingWave UDF API for Python. | ||
--- | ||
|
||
You can define your own functions (including table functions) and call these functions in RisingWave. With the user-defined function (UDF), you can tailor RisingWave to your needs and take advantage of the power and flexibility of Python to create complex and customized functionality for your data processing and analysis tasks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second paragraph is a bit too wordy. Suggestion: ...-> ..of Python to perform complex and customized data processing and analysis tasks.
|
||
## 2. Define your functions in a Python file | ||
|
||
To better demonstrate this step, we have prepared a sample script for you to try out. Please create a Python file with the name "udf.py" and insert the script below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think file names should also be wrapped in code blocks. Correct me if I'm wrong.
|
||
#### Example | ||
|
||
Here's the SQL statements for declaring the three UDFs defined in [step 2](#2-define-your-functions-in-a-python-file). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's -> Here are...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments. Otherwise looks good to me. Really solid work. Thanks!
Info
Preview:
https://pr-689.d2fbku9n2b6wde.amplifyapp.com/docs/upcoming/user-defined-functions/
Related code PR:
doc(udf): improve UDF documentation risingwave#8597
Related doc issue:
Resolves Document UDF #659
Notes:
[ Any additional information? ]
Before merging
bernscode
,CharlieSYH
,emile-00
, &hengm3467
).How?
Scroll down and open this link: