Skip to content

Commit 05c1652

Browse files
soyeric128BohuTANG
authored andcommitted
SHOW USER FUNCTIONS
1 parent 19d7d17 commit 05c1652

File tree

2 files changed

+44
-12
lines changed

2 files changed

+44
-12
lines changed

docs/en/guides/54-query/03-udf.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ import EEFeature from '@site/src/components/EEFeature';
99

1010
User-Defined Functions (UDFs) offer enhanced flexibility by supporting both anonymous lambda expressions and predefined handlers (Python, JavaScript & WebAssembly) for defining UDFs. These features allow users to create custom operations tailored to their specific data processing needs. Databend UDFs are categorized into the following types:
1111

12-
- [Lambda UDFs](#lambda-udf)
12+
- [Lambda UDFs](#lambda-udfs)
1313
- [Embedded UDFs](#embedded-udfs)
1414

15-
Databend provides a variety of commands to manage UDFs. For details, see [User-Defined Function](/sql/sql-commands/ddl/udf/).
16-
17-
## Lambda UDF
15+
## Lambda UDFs
1816

1917
A lambda UDF allows users to define custom operations using anonymous functions (lambda expressions) directly within their queries. These lambda expressions are often concise and can be used to perform specific data transformations or computations that may not be achievable using built-in functions alone.
2018

@@ -24,8 +22,17 @@ This example creates UDFs to extract specific values from JSON data within a tab
2422

2523
```sql
2624
-- Define UDFs
27-
CREATE FUNCTION get_v1 AS (json) -> json["v1"];
28-
CREATE FUNCTION get_v2 AS (json) -> json["v2"];
25+
CREATE FUNCTION get_v1 AS (input_json) -> input_json['v1'];
26+
CREATE FUNCTION get_v2 AS (input_json) -> input_json['v2'];
27+
28+
SHOW USER FUNCTIONS;
29+
30+
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
31+
│ name │ is_aggregate │ description │ arguments │ language │ created_on │
32+
├────────┼───────────────────┼─────────────┼───────────────────────────────┼──────────┼────────────────────────────┤
33+
│ get_v1 │ NULL │ │ {"parameters":["input_json"]} │ SQL │ 2024-11-18 23:20:28.432842
34+
│ get_v2 │ NULL │ │ {"parameters":["input_json"]} │ SQL │ 2024-11-18 23:21:46.838744
35+
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
2936

3037
-- Create a table
3138
CREATE TABLE json_table(time TIMESTAMP, data JSON);
@@ -257,10 +264,6 @@ WHERE
257264
ORDER BY 1;
258265
```
259266

260-
## Show Created UDF
267+
## Managing UDFs
261268

262-
If you want to show UDF you have already created.
263-
264-
```sql
265-
show user functions;
266-
```
269+
Databend provides a variety of commands to manage UDFs. For details, see [User-Defined Function](/sql/sql-commands/ddl/udf/).
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: SHOW USER FUNCTIONS
3+
sidebar_position: 1
4+
---
5+
import FunctionDescription from '@site/src/components/FunctionDescription';
6+
7+
<FunctionDescription description="Introduced or updated: v1.2.558"/>
8+
9+
Lists all user-defined functions (UDFs), including their names, types, descriptions, arguments, languages, and creation timestamps.
10+
11+
## Syntax
12+
13+
```sql
14+
SHOW USER FUNCTIONS
15+
```
16+
17+
## Examples
18+
19+
```sql
20+
SHOW USER FUNCTIONS;
21+
22+
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
23+
│ name │ is_aggregate │ description │ arguments │ language │ created_on │
24+
│ String │ Nullable(Boolean) │ String │ Variant │ String │ Timestamp
25+
├────────┼───────────────────┼─────────────┼───────────────────────────────┼──────────┼────────────────────────────┤
26+
│ get_v1 │ NULL │ │ {"parameters":["input_json"]} │ SQL │ 2024-11-18 23:20:28.432842
27+
│ get_v2 │ NULL │ │ {"parameters":["input_json"]} │ SQL │ 2024-11-18 23:21:46.838744
28+
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
29+
```

0 commit comments

Comments
 (0)