lake: add UDF docs - #23544
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Skipping CI for Draft Pull Request. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds and surfaces TiDB Cloud Lake UDF documentation, including a new guide to help users choose among UDF types, and updates the External Function docs and examples to use the tidbcloudlake-udf package and public HTTPS endpoints.
Changes:
- Adds a new “Choose a User-Defined Function Type” guide and links it from the Lake TOC.
- Exposes the “External AI Functions” guide in the Lake TOC and updates Python examples to use
tidbcloudlake-udf. - Updates External Function navigation and examples, including adding the
CREATE FUNCTIONreference entry.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| TOC-tidb-cloud-lake.md | Adds TOC entries for External AI Functions, the UDF type selection guide, and External Function command references. |
| tidb-cloud-lake/sql/external-function.md | Updates the External Function overview table to point at the correct command pages (and should align link text with actual SQL statements). |
| tidb-cloud-lake/sql/create-function.md | Updates the external function end-to-end example to use tidbcloudlake-udf and a public HTTPS ADDRESS. |
| tidb-cloud-lake/sql/alter-function-sql.md | Updates external function ADDRESS examples to a public HTTPS endpoint. |
| tidb-cloud-lake/guides/external-ai-functions.md | Updates the external AI function example to use tidbcloudlake-udf. |
| tidb-cloud-lake/guides/choose-a-udf-type.md | Adds a new guide explaining how to choose between SQL/script/WASM/aggregate/table/external UDF types and operational considerations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| | [CREATE EXTERNAL FUNCTION](/tidb-cloud-lake/sql/create-function.md) | Creates a new external function | | ||
| | [ALTER EXTERNAL FUNCTION](/tidb-cloud-lake/sql/alter-function-sql.md) | Modifies an existing external function | | ||
| | [DROP EXTERNAL FUNCTION](/tidb-cloud-lake/sql/drop-function-sql.md) | Removes an external function | |
|
|
||
| ```bash | ||
| pip install databend-udf | ||
| pip install tidbcloudlake-udf |
| CREATE FUNCTION gcd AS (INT, INT) | ||
| RETURNS INT | ||
| LANGUAGE python | ||
| HANDLER = 'gcd' | ||
| ADDRESS = 'http://localhost:8815'; | ||
| ADDRESS = 'https://udf.example.com'; |
| - standardizing data cleaning, validation, and business calculations; | ||
| - encapsulating a parameterized SQL query; | ||
| - implementing a custom aggregation that needs intermediate state; | ||
| - calling Python libraries, proprietary logic, or machine learning models; | ||
| - scaling specialized compute independently from the warehouse. |
What is changed, added or deleted? (Required)
This PR publishes TiDB Cloud Lake UDF (user-defined functions) documentation with minimal changes to existing pages:
CREATE FUNCTIONreference in the Lake TOC;tidbcloudlake-udfandtidbcloudlake_udfin external Python examples;The examples were validated against the published
tidbcloudlake-udfv0.2.20 package and a staging Lake warehouse. SQL scalar/table UDFs and Python/JavaScript aggregate UDFs passed. External registration correctly returnedUnallowed UDF server addressfor a hostname not yet added to the tenant allowlist.Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions.
What is the related PR or file link(s)?
AI agent involvement
Do your changes match any of the following descriptions?