-
Notifications
You must be signed in to change notification settings - Fork 836
feat: impl UDTF Server #18947
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
base: main
Are you sure you want to change the base?
feat: impl UDTF Server #18947
Conversation
f70f28c to
4bf1527
Compare
4bf1527 to
a588a7b
Compare
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.
💡 Codex Review
databend/src/query/sql/src/planner/semantic/type_check.rs
Lines 5296 to 5313 in b4ef59d
| pub async fn fold_udf_server( | |
| &mut self, | |
| name: &str, | |
| args: Vec<Scalar>, | |
| udf_definition: UDFServer, | |
| ) -> Result<Scalar> { | |
| let mut block_entries = Vec::with_capacity(args.len()); | |
| for (arg, dest_type) in args.into_iter().zip( | |
| udf_definition | |
| .arg_types | |
| .iter() | |
| .filter(|ty| ty.remove_nullable() != DataType::StageLocation), | |
| ) { | |
| if matches!(dest_type, DataType::StageLocation) { | |
| continue; | |
| } | |
| let entry = BlockEntry::new_const_column(dest_type.clone(), arg, 1); | |
| block_entries.push(entry); |
When folding immutable server UDFs, the loop builds Flight arguments by zipping the full args list with udf_definition.arg_types.iter().filter(|ty| ty.remove_nullable() != DataType::StageLocation). Because only the type iterator is filtered, any StageLocation arguments remain in args but are now paired with the next non-stage type. The first stage argument is therefore sent with the wrong type, and every subsequent argument shifts left while the final argument is dropped. For immutable UDFs that accept a stage location, constant evaluation will call the external server with misordered or missing parameters, producing incorrect results or server-side errors. The loop should filter both sequences consistently (e.g. iterate all pairs and continue when the type is StageLocation).
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
python: databendlabs/databend-udf#16
Supports remote external UDTF, and also supports STAGE_LOCATION as a parameter type.
Tests
Type of change
This change is