-
Notifications
You must be signed in to change notification settings - Fork 590
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
feat(udf): Add deno as UDF language #15719
Conversation
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.
Thanks for your amazing work! Could you share the background and your motivation of the work? like why do you need it, what's its advantage over current js
UDF, what's not achievable now?
Users may feel strange that there are both js
UDF and deno
UDF, if they are not very familiar with js runtimes. So it's important to figure out whether we want both of them, and if so, make clear the difference for users.
@xxchan TLDR The main motivation is being able to use web apis (fetch, crypto) as part of the UDFS, the full conversation here https://risingwave-community.slack.com/archives/C02T3F7UYM6/p1709825596494219 |
Got it. Sorry that I missed the Slack discussion. For such large feature, it would still be nicer if we open an issue to have larger visibility and more discussion before the PR. ❤️ |
2e01bf8
to
61175b3
Compare
e55f8c0
to
8fc2c6a
Compare
Also do you think the sintax |
According to postgres' documentation, the For simplicity, is it possible to just assume |
let schema = serde_json::from_str::<Value>(&schema).unwrap(); | ||
let ans = serde_json::from_str::<Value>(ans).unwrap(); | ||
assert_eq!(schema, ans); |
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.
This seems irrelevant to the UDF feature?
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.
It was due an update in the dependencies, the order of the string changed, so I changed it to use json instead of just plain string, because the order should not matter
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.
This was because deno_core
adds the feature preserve_order
for serde_json
, I patched the dependency to remove it, but I'm not sure if this is the right place to do so
Lines 309 to 310 in cd2c0d4
# patch to remove preserve_order from serde_json | |
deno_core = { git = "https://github.com/bakjos/deno_core", rev = "70d1544" } |
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'm okay with this patch. cc @xxchan any better idea on this feature interaction?
Please also add some end-to-end tests in risingwave/e2e_test/udf/retry_python.slt Lines 1 to 2 in fb7fadb
|
I like the idea of introducing new keywords, the main issue is with AsyncIterators vs generators in the table function since it changes the signature of the function, so |
f0d4399
to
a0c2285
Compare
Seems the deno e2e test is still flaky. 👀
|
@wangrunji0408 This started to happen after I switched from rust to python to the mock server, I changed the protocol from HTTP 1 to HTTP 1.1 to see if fix it |
@wangrunji0408 Updating the protocol didn't work, so I made some extra changes over arrow-udf/arrow-udf#12 and changed the tests to use a single mock server for both sse and rest, and it seems to have fixed the issue. I ran the test 100 times and got no crash/error. Also, merged the latest changes to run the tests twice, and it was also successful both times |
This reverts commit a1b4b51.
Also unsure what's wrong here: |
@wangrunji0408 I created this PR #16263 |
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR add the option to use deno as udf language, it includes
fetch
,web
andcrypto
API support.I added support for setting the function type when creating a function
ASYNC
async function <name> { <body> }
ASYNC GENERATOR
async function* <name> { <body> }
GENERATOR
function* <name> { <body> }
SYNC
function <name> { <body> }
If not defined will use
normal
for UDFs andgenerator
for table functions;I put the deno language support under a feature flag, which is currently enabled by default. (Plan to remove before this PR gets merged).
It will require arrow-udf/arrow-udf#7 to get merged
I'd also like to use one of the table functions as a source (to receive data from websockets or sse). But it's not currently supported. What do you think would be a good way to do it?
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.