diff --git a/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-aggregate-function.md b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-aggregate-function.md new file mode 100644 index 0000000000..c5f856b2b9 --- /dev/null +++ b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-aggregate-function.md @@ -0,0 +1,151 @@ +--- +title: CREATE AGGREGATE FUNCTION +sidebar_position: 1 +--- +import FunctionDescription from '@site/src/components/FunctionDescription'; + + + +创建用户自定义聚合函数(UDAF),在 Databend 内置的 JavaScript 或 Python 运行时中执行。 + +### 支持的语言 + +- `javascript` +- `python` + +## 语法 + +```sql +CREATE [ OR REPLACE ] FUNCTION [ IF NOT EXISTS ] + ( [ ] ) + STATE { } + RETURNS + LANGUAGE + [ IMPORTS = () ] + [ PACKAGES = () ] +AS $$ + +$$ +[ DESC='' ] +``` + +| 参数 | 说明 | +| --- | --- | +| `` | 聚合函数名称。 | +| `` | 可选的输入参数及其类型,例如 `value DOUBLE`。 | +| `STATE { }` | 定义聚合过程中需要在部分聚合和最终聚合步骤间持久化的状态结构(例如 `STATE { sum DOUBLE, count DOUBLE }`)。 | +| `` | 聚合返回的数据类型。 | +| `LANGUAGE` | 运行脚本的语言,支持 `javascript`、`python`。 | +| `IMPORTS` / `PACKAGES` | 可选列表,用于加载额外文件(imports)或 PyPI 包(仅限 Python)。 | +| `` | 脚本主体,必须实现并暴露 `create_state`、`accumulate`、`merge` 和 `finish` 入口函数。 | +| `DESC` | 可选描述。 | + +脚本需要实现以下函数: + +- `create_state()` – 分配并返回初始状态对象。 +- `accumulate(state, *args)` – 针对每个输入行更新状态。 +- `merge(state1, state2)` – 合并两个部分聚合状态。 +- `finish(state)` – 生成最终结果(返回 `None` 表示 SQL `NULL`)。 + +## 访问控制要求 + +| 权限 | 对象类型 | 描述 | +|:-----|:---------|:-----| +| SUPER | 全局、表 | 操作 UDF | + +创建 UDF 的用户或其 [current_role](/guides/security/access-control/roles) 必须拥有 SUPER [权限](/guides/security/access-control/privileges)。 + +## 示例 + +### Python 平均值 UDAF + +以下 Python 聚合函数示例用于计算列的平均值: + +```sql +CREATE OR REPLACE FUNCTION py_avg (value DOUBLE) + STATE { sum DOUBLE, count DOUBLE } + RETURNS DOUBLE + LANGUAGE python +AS $$ +class State: + def __init__(self): + self.sum = 0.0 + self.count = 0.0 + +def create_state(): + return State() + +def accumulate(state, value): + if value is not None: + state.sum += value + state.count += 1 + return state + +def merge(state1, state2): + state1.sum += state2.sum + state1.count += state2.count + return state1 + +def finish(state): + if state.count == 0: + return None + return state.sum / state.count +$$; + +SELECT py_avg(number) AS avg_val FROM numbers(5); +``` + +``` ++---------+ +| avg_val | ++---------+ +| 2 | ++---------+ +``` + +### JavaScript 平均值 UDAF + +下面示例演示如何使用 JavaScript 完成相同的平均值计算: + +```sql +CREATE OR REPLACE FUNCTION js_avg (value DOUBLE) + STATE { sum DOUBLE, count DOUBLE } + RETURNS DOUBLE + LANGUAGE javascript +AS $$ +export function create_state() { + return { sum: 0, count: 0 }; +} + +export function accumulate(state, value) { + if (value !== null) { + state.sum += value; + state.count += 1; + } + return state; +} + +export function merge(state1, state2) { + state1.sum += state2.sum; + state1.count += state2.count; + return state1; +} + +export function finish(state) { + if (state.count === 0) { + return null; + } + return state.sum / state.count; +} +$$; + +SELECT js_avg(number) AS avg_val FROM numbers(5); +``` + +``` ++---------+ +| avg_val | ++---------+ +| 2 | ++---------+ +``` diff --git a/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function-embedded.md b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function-embedded.md index 7318a32e34..997b950179 100644 --- a/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function-embedded.md +++ b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function-embedded.md @@ -1,6 +1,6 @@ --- title: CREATE EMBEDDED FUNCTION -sidebar_position: 2 +sidebar_position: 3 --- import FunctionDescription from '@site/src/components/FunctionDescription'; @@ -207,4 +207,4 @@ AS $$@s_udf/arrow_udf_example.wasm$$; -- 使用函数 SELECT fib_wasm(10) AS fibonacci_result; -``` \ No newline at end of file +``` diff --git a/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md index f50ef48e43..9187a63649 100644 --- a/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md +++ b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md @@ -6,7 +6,11 @@ import FunctionDescription from '@site/src/components/FunctionDescription'; -使用 Databend 的统一函数语法创建标量 SQL UDF(User-Defined Function)。 +使用 Databend 的统一函数语法创建标量 SQL UDF。其逻辑完全由 SQL 定义,无需外部编程语言支持。 + +### 支持语言 + +- 仅支持 SQL 表达式(无需外部运行时环境) ## 语法 @@ -59,4 +63,4 @@ $$; SELECT area_of_circle(5.0) AS circle_area; SELECT calculate_age('1990-05-15') AS age; SELECT calculate_bmi(70.0, 1.75) AS bmi; -``` \ No newline at end of file +``` diff --git a/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-table-function.md b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-table-function.md index 3659559cc2..a6ac34c416 100644 --- a/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-table-function.md +++ b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-table-function.md @@ -1,12 +1,16 @@ --- title: CREATE TABLE FUNCTION -sidebar_position: 1 +sidebar_position: 2 --- import FunctionDescription from '@site/src/components/FunctionDescription'; -创建表格式 SQL UDF(UDTF),将 SQL 查询封装为表函数。为保持一致性,使用与标量函数相同的统一 `$$` 语法。当前仅支持基于 SQL 的表函数。 +创建表值 SQL UDF (UDTF),将 SQL 查询封装为表函数。此类函数完全使用 SQL 编写,不涉及外部编程语言。 + +### 支持语言 + +- 仅支持 SQL 查询(无需外部运行时环境) ## 语法 @@ -83,4 +87,4 @@ AS $$ SELECT department, COUNT(*) as employee_count, AVG(salary) as avg_salary F -- 使用复杂表函数 SELECT * FROM get_department_stats(); -``` \ No newline at end of file +``` diff --git a/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/index.md b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/index.md index c6a4d51a2b..05a27ef747 100644 --- a/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/index.md +++ b/docs/cn/sql-reference/10-sql-commands/00-ddl/10-udf/index.md @@ -2,30 +2,31 @@ title: 用户自定义函数 --- -Databend 中的用户自定义函数(User-Defined Function,UDF)允许您根据特定的数据处理需求创建自定义操作。本页面将帮助您为具体用例选择合适的函数类型。 - -## 函数类型对比 - -| 特性 | 标量 SQL(Scalar SQL) | 表格 SQL(Tabular SQL) | 嵌入式(Embedded) | -|---|---|---|---| -| **返回类型** | 单个值 | 表/结果集 | 单个值 | -| **语言** | SQL 表达式 | SQL 查询 | Python/JavaScript/WASM | -| **性能** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | -| **需要企业版** | 否 | 否 | Python:是 | -| **包支持** | 否 | 否 | Python:是 | -| **最佳适用场景** | 数学计算
字符串操作
数据格式化 | 复杂查询
多行结果
数据转换 | 高级算法
外部库
控制流逻辑 | +Databend 中的用户自定义函数(User-Defined Function,UDF)允许您根据特定的数据处理需求创建自定义操作。本页将重点介绍常用命令,并帮助您选择适合您用例的函数类型。 ## 函数管理命令 | 命令 | 描述 | |---|---| -| [CREATE SCALAR FUNCTION](ddl-create-function.md) | 使用统一语法创建标量 SQL 函数 | -| [CREATE TABLE FUNCTION](ddl-create-table-function.md) | 创建返回结果集的表格函数 | -| [CREATE EMBEDDED FUNCTION](ddl-create-function-embedded.md) | 创建嵌入式函数(Python/JavaScript/WASM) | +| [CREATE SCALAR FUNCTION](ddl-create-function.md) | 纯 SQL 标量函数(无外部语言) | +| [CREATE AGGREGATE FUNCTION](ddl-create-aggregate-function.md) | 脚本 UDAF(JavaScript/Python 运行时) | +| [CREATE TABLE FUNCTION](ddl-create-table-function.md) | 纯 SQL 表函数(返回结果集) | +| [CREATE EMBEDDED FUNCTION](ddl-create-function-embedded.md) | 嵌入式函数(Python/JavaScript/WASM) | | [SHOW USER FUNCTIONS](ddl-show-user-functions.md) | 列出所有用户自定义函数 | | [ALTER FUNCTION](ddl-alter-function.md) | 修改现有函数 | | [DROP FUNCTION](ddl-drop-function.md) | 移除函数 | +## 函数类型对比 + +| 特性 | 标量 SQL(Scalar) | 聚合(脚本) | 表格 SQL(Tabular) | 嵌入式(Embedded) | +|---|---|---|---|---| +| **返回类型** | 单个值 | 单个值 | 表/结果集 | 单个值 | +| **语言** | SQL 表达式 | JavaScript/Python 运行时 | SQL 查询 | Python/JavaScript/WASM | +| **性能** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | +| **需要企业版** | 否 | Python 运行时需要 | 否 | Python 运行时需要 | +| **包支持** | 否 | Python:支持 PACKAGES | 否 | Python:支持 PACKAGES | +| **最佳适用场景** | 数学计算
字符串操作
数据格式化 | 自定义聚合逻辑
需要脚本语言处理 | 复杂查询
多行结果
数据转换 | 高级算法
外部库
控制流逻辑 | + ## 统一语法 所有本地 UDF 类型都使用一致的 `$$` 语法: @@ -40,4 +41,4 @@ CREATE FUNCTION func_name(param TYPE) RETURNS TABLE(...) AS $$ query $$; -- 嵌入式函数 CREATE FUNCTION func_name(param TYPE) RETURNS TYPE LANGUAGE python HANDLER = 'handler' AS $$ code $$; -``` \ No newline at end of file +``` diff --git a/docs/cn/sql-reference/10-sql-commands/00-ddl/11-external-function/ddl-create-function.md b/docs/cn/sql-reference/10-sql-commands/00-ddl/11-external-function/ddl-create-function.md index c68f67d490..0712d5e77e 100644 --- a/docs/cn/sql-reference/10-sql-commands/00-ddl/11-external-function/ddl-create-function.md +++ b/docs/cn/sql-reference/10-sql-commands/00-ddl/11-external-function/ddl-create-function.md @@ -6,7 +6,11 @@ import FunctionDescription from '@site/src/components/FunctionDescription'; -创建外部函数(External Function)。 +创建外部函数(External Function),通过 Flight 协议调用远程处理程序(通常为 Python 或其他服务)。 + +### 支持语言 + +- 由远程服务器实现决定(常见为 Python,只要实现了 Flight 接口,可以使用任意语言) ## 语法 @@ -39,4 +43,4 @@ CREATE FUNCTION gcd AS (INT, INT) LANGUAGE python HANDLER = 'gcd' ADDRESS = 'http://localhost:8815'; -``` \ No newline at end of file +``` diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-aggregate-function.md b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-aggregate-function.md new file mode 100644 index 0000000000..454b7d5ff8 --- /dev/null +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-aggregate-function.md @@ -0,0 +1,151 @@ +--- +title: CREATE AGGREGATE FUNCTION +sidebar_position: 1 +--- +import FunctionDescription from '@site/src/components/FunctionDescription'; + + + +Creates a user-defined aggregate function (UDAF) that runs inside Databend's JavaScript or Python runtime. + +### Supported Languages + +- `javascript` +- `python` + +## Syntax + +```sql +CREATE [ OR REPLACE ] FUNCTION [ IF NOT EXISTS ] + ( [ ] ) + STATE { } + RETURNS + LANGUAGE + [ IMPORTS = () ] + [ PACKAGES = () ] +AS $$ + +$$ +[ DESC='' ] +``` + +| Parameter | Description | +| --- | --- | +| `` | Name of the aggregate function. | +| `` | Optional comma-separated list of input parameters and types (for example `value DOUBLE`). | +| `STATE { }` | Struct definition that Databend stores between partial/final aggregation steps (for example `STATE { sum DOUBLE, count DOUBLE }`). | +| `` | Data type returned by the aggregate (`DOUBLE`, `INT`, etc.). | +| `LANGUAGE` | Runtime used to execute the script. Supported values: `javascript`, `python`. | +| `IMPORTS` / `PACKAGES` | Optional lists for shipping extra files (imports) or PyPI packages (Python only). | +| `` | Script body that must expose `create_state`, `accumulate`, `merge`, and `finish` entry points. | +| `DESC` | Optional description. | + +The script must implement these functions: + +- `create_state()` – allocate and return an initial state object. +- `accumulate(state, *args)` – update the state for each input row. +- `merge(state1, state2)` – merge two partial states. +- `finish(state)` – produce the final result (return `None` for SQL `NULL`). + +## Access control requirements + +| Privilege | Object Type | Description | +|:----------|:--------------|:---------------| +| SUPER | Global, Table | Operates a UDF | + +To create a user-defined function, the user performing the operation or the [current_role](/guides/security/access-control/roles) must have the SUPER [privilege](/guides/security/access-control/privileges). + +## Examples + +### Python average UDAF + +The following Python aggregate computes the average of a column: + +```sql +CREATE OR REPLACE FUNCTION py_avg (value DOUBLE) + STATE { sum DOUBLE, count DOUBLE } + RETURNS DOUBLE + LANGUAGE python +AS $$ +class State: + def __init__(self): + self.sum = 0.0 + self.count = 0.0 + +def create_state(): + return State() + +def accumulate(state, value): + if value is not None: + state.sum += value + state.count += 1 + return state + +def merge(state1, state2): + state1.sum += state2.sum + state1.count += state2.count + return state1 + +def finish(state): + if state.count == 0: + return None + return state.sum / state.count +$$; + +SELECT py_avg(number) AS avg_val FROM numbers(5); +``` + +``` ++---------+ +| avg_val | ++---------+ +| 2 | ++---------+ +``` + +### JavaScript average UDAF + +The next example shows the same calculation implemented in JavaScript: + +```sql +CREATE OR REPLACE FUNCTION js_avg (value DOUBLE) + STATE { sum DOUBLE, count DOUBLE } + RETURNS DOUBLE + LANGUAGE javascript +AS $$ +export function create_state() { + return { sum: 0, count: 0 }; +} + +export function accumulate(state, value) { + if (value !== null) { + state.sum += value; + state.count += 1; + } + return state; +} + +export function merge(state1, state2) { + state1.sum += state2.sum; + state1.count += state2.count; + return state1; +} + +export function finish(state) { + if (state.count === 0) { + return null; + } + return state.sum / state.count; +} +$$; + +SELECT js_avg(number) AS avg_val FROM numbers(5); +``` + +``` ++---------+ +| avg_val | ++---------+ +| 2 | ++---------+ +``` diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function-embedded.md b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function-embedded.md index 7fb5582a69..cf0477d12d 100644 --- a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function-embedded.md +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function-embedded.md @@ -1,6 +1,6 @@ --- title: CREATE EMBEDDED FUNCTION -sidebar_position: 2 +sidebar_position: 3 --- import FunctionDescription from '@site/src/components/FunctionDescription'; @@ -208,4 +208,3 @@ AS $$@s_udf/arrow_udf_example.wasm$$; -- Use the function SELECT fib_wasm(10) AS fibonacci_result; ``` - diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md index 9de897a825..5b084ff549 100644 --- a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md @@ -6,7 +6,11 @@ import FunctionDescription from '@site/src/components/FunctionDescription'; -Creates a Scalar SQL UDF using Databend's unified function syntax. +Creates a scalar SQL UDF using Databend's unified function syntax. Logic is expressed purely in SQL; no external language support is required. + +### Supported Languages + +- SQL expressions only (no external runtimes) ## Syntax @@ -60,4 +64,3 @@ SELECT area_of_circle(5.0) AS circle_area; SELECT calculate_age('1990-05-15') AS age; SELECT calculate_bmi(70.0, 1.75) AS bmi; ``` - diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-table-function.md b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-table-function.md index eb86d9c093..c1a284cb77 100644 --- a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-table-function.md +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-table-function.md @@ -1,12 +1,16 @@ --- title: CREATE TABLE FUNCTION -sidebar_position: 1 +sidebar_position: 2 --- import FunctionDescription from '@site/src/components/FunctionDescription'; -Creates a Tabular SQL UDF (UDTF) that encapsulates SQL queries as a table function. Uses the same unified `$$` syntax as scalar functions for consistency. Currently supports SQL-based table functions only. +Creates a tabular SQL UDF (UDTF) that encapsulates SQL queries as a table function. Table functions are written in SQL; no external languages are involved. + +### Supported Languages + +- SQL queries only (no external runtimes) ## Syntax @@ -83,4 +87,4 @@ AS $$ SELECT department, COUNT(*) as employee_count, AVG(salary) as avg_salary F -- Use the complex table function SELECT * FROM get_department_stats(); -``` \ No newline at end of file +``` diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/index.md b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/index.md index 87dcbe87fc..d954c3019c 100644 --- a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/index.md +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/index.md @@ -2,31 +2,31 @@ title: User-Defined Function --- -User-Defined Functions (UDFs) in Databend allow you to create custom operations tailored to your specific data processing needs. This page helps you choose the right type of function for your use case. - -## Function Type Comparison - -| Feature | Scalar SQL | Tabular SQL | Embedded | -|---------|------------|-------------|----------| -| **Return Type** | Single value | Table/ResultSet | Single value | -| **Language** | SQL expressions | SQL queries | Python/JavaScript/WASM | -| **Performance** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | -| **Enterprise Required** | No | No | Python: Yes | -| **Package Support** | No | No | Python: Yes | -| **Best For** | Math calculations
String operations
Data formatting | Complex queries
Multi-row results
Data transformations | Advanced algorithms
External libraries
Control flow logic | - +User-Defined Functions (UDFs) in Databend allow you to create custom operations tailored to your specific data processing needs. This page highlights the commands you will use most often and helps you choose the right function type for your use case. ## Function Management Commands | Command | Description | |---------|-------------| -| [CREATE SCALAR FUNCTION](ddl-create-function.md) | Creates a scalar SQL function using unified syntax | -| [CREATE TABLE FUNCTION](ddl-create-table-function.md) | Creates a table function that returns result sets | -| [CREATE EMBEDDED FUNCTION](ddl-create-function-embedded.md) | Creates embedded functions (Python/JavaScript/WASM) | +| [CREATE SCALAR FUNCTION](ddl-create-function.md) | SQL-only scalar function (no external language) | +| [CREATE AGGREGATE FUNCTION](ddl-create-aggregate-function.md) | Script UDAF (JavaScript/Python runtimes) | +| [CREATE TABLE FUNCTION](ddl-create-table-function.md) | SQL-only table function returning result sets | +| [CREATE EMBEDDED FUNCTION](ddl-create-function-embedded.md) | Embedded scalar functions (Python/JavaScript/WASM) | | [SHOW USER FUNCTIONS](ddl-show-user-functions.md) | Lists all user-defined functions | | [ALTER FUNCTION](ddl-alter-function.md) | Modifies existing functions | | [DROP FUNCTION](ddl-drop-function.md) | Removes functions | +## Function Type Comparison + +| Feature | Scalar SQL | Aggregate (Script) | Tabular SQL | Embedded | +|---------|------------|--------------------|-------------|----------| +| **Return Type** | Single value | Single value | Table/ResultSet | Single value | +| **Language** | SQL expressions | JavaScript/Python runtimes | SQL queries | Python/JavaScript/WASM | +| **Performance** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | +| **Enterprise Required** | No | Python runtime only | No | Python runtime only | +| **Package Support** | No | Python: Yes (PACKAGES) | No | Python: Yes (PACKAGES) | +| **Best For** | Math calculations
String operations
Data formatting | Custom aggregations that need scripting logic | Complex queries
Multi-row results
Data transformations | Advanced algorithms
External libraries
Control flow logic | + ## Unified Syntax All local UDF types use consistent `$$` syntax: @@ -42,4 +42,3 @@ CREATE FUNCTION func_name(param TYPE) RETURNS TABLE(...) AS $$ query $$; CREATE FUNCTION func_name(param TYPE) RETURNS TYPE LANGUAGE python HANDLER = 'handler' AS $$ code $$; ``` - diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/11-external-function/ddl-create-function.md b/docs/en/sql-reference/10-sql-commands/00-ddl/11-external-function/ddl-create-function.md index 9d8d8e0a47..e61e16af2e 100644 --- a/docs/en/sql-reference/10-sql-commands/00-ddl/11-external-function/ddl-create-function.md +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/11-external-function/ddl-create-function.md @@ -6,7 +6,11 @@ import FunctionDescription from '@site/src/components/FunctionDescription'; -Creates an external function. +Creates an external function that calls a remote handler over Flight (typically Python or other services). + +### Supported Languages + +- Determined by the remote server (commonly Python, but any language can be used as long as it implements the Flight endpoint) ## Syntax @@ -39,4 +43,4 @@ CREATE FUNCTION gcd AS (INT, INT) LANGUAGE python HANDLER = 'gcd' ADDRESS = 'http://localhost:8815'; -``` \ No newline at end of file +```