Skip to content

Commit 15b0be3

Browse files
authored
[Update] doc 4.0 part2 (#3044)
This is the second pr to add 4.0 docs. Details at #3004
1 parent 66f9ecf commit 15b0be3

File tree

555 files changed

+49032
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

555 files changed

+49032
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
{
3+
"title": "AI_CLASSIFY",
4+
"language": "en"
5+
}
6+
---
7+
8+
<!--
9+
Licensed to the Apache Software Foundation (ASF) under one
10+
or more contributor license agreements. See the NOTICE file
11+
distributed with this work for additional information
12+
regarding copyright ownership. The ASF licenses this file
13+
to you under the Apache License, Version 2.0 (the
14+
"License"); you may not use this file except in compliance
15+
with the License. You may obtain a copy of the License at
16+
17+
http://www.apache.org/licenses/LICENSE-2.0
18+
19+
Unless required by applicable law or agreed to in writing,
20+
software distributed under the License is distributed on an
21+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22+
KIND, either express or implied. See the License for the
23+
specific language governing permissions and limitations
24+
under the License.
25+
-->
26+
27+
## Description
28+
29+
Used to classify text into a specified set of labels.
30+
31+
## Syntax
32+
33+
```sql
34+
AI_CLASSIFY([<resource_name>], <text>, <labels>)
35+
```
36+
37+
## Parameters
38+
39+
| Parameter | Description |
40+
| ----------------- | ------------------------------------------- |
41+
| `<resource_name>` | The specified resource name, optional |
42+
| `<text>` | The text to be classified |
43+
| `<labels>` | Array of classification labels |
44+
45+
## Return Value
46+
47+
Returns the single label that best matches the text.
48+
49+
If any input is NULL, returns NULL.
50+
51+
The result is generated by a large language model, so the output may vary.
52+
53+
## Examples
54+
55+
```sql
56+
SET default_ai_resource = 'resource_name';
57+
SELECT AI_CLASSIFY('Apache Doris is a databases system.', ['useage', 'introduce']) AS Result;
58+
```
59+
```text
60+
+-----------+
61+
| Result |
62+
+-----------+
63+
| introduce |
64+
+-----------+
65+
```
66+
67+
```sql
68+
SELECT AI_CLASSIFY('resource_name', 'Apache Doris is developing rapidly.', ['science', 'sport']) AS Result;
69+
```
70+
```text
71+
+---------+
72+
| Result |
73+
+---------+
74+
| science |
75+
+---------+
76+
```
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
{
3+
"title": "AI_EXTRACT",
4+
"language": "en"
5+
}
6+
---
7+
8+
<!--
9+
Licensed to the Apache Software Foundation (ASF) under one
10+
or more contributor license agreements. See the NOTICE file
11+
distributed with this work for additional information
12+
regarding copyright ownership. The ASF licenses this file
13+
to you under the Apache License, Version 2.0 (the
14+
"License"); you may not use this file except in compliance
15+
with the License. You may obtain a copy of the License at
16+
17+
http://www.apache.org/licenses/LICENSE-2.0
18+
19+
Unless required by applicable law or agreed to in writing,
20+
software distributed under the License is distributed on an
21+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22+
KIND, either express or implied. See the License for the
23+
specific language governing permissions and limitations
24+
under the License.
25+
-->
26+
27+
## Description
28+
29+
Used to extract information corresponding to specific labels from text.
30+
31+
## Syntax
32+
33+
```sql
34+
AI_EXTRACT([<resource_name>], <text>, <labels>)
35+
```
36+
37+
## Parameters
38+
39+
| Parameter | Description |
40+
| ----------------- | -------------------------------------------- |
41+
| `<resource_name>` | The specified resource name, optional |
42+
| `<text>` | The text from which to extract information |
43+
| `<labels>` | Array of labels to extract |
44+
45+
## Return Value
46+
47+
Returns a string containing all extracted labels and their corresponding values.
48+
49+
If any input is NULL, returns NULL.
50+
51+
The result is generated by a large language model, so the output may vary.
52+
53+
## Examples
54+
55+
```sql
56+
SET default_ai_resource = 'resource_name';
57+
SELECT AI_EXTRACT('Apache Doris is an MPP-based real-time data warehouse known for its high query speed.',
58+
['product_name', 'architecture', 'key_feature']) AS Result;
59+
```
60+
```text
61+
+---------------------------------------------------------------------------------------+
62+
| Result |
63+
+---------------------------------------------------------------------------------------+
64+
| product_name="Apache Doris", architecture="MPP-based", key_feature="high query speed" |
65+
+---------------------------------------------------------------------------------------+
66+
```
67+
68+
```sql
69+
SELECT AI_EXTRACT('resource_name', 'Apache Doris began in 2008 as an internal project named Palo.',
70+
['original name', 'founding time']) AS Result;
71+
```
72+
```text
73+
+----------------------------------------+
74+
| Result |
75+
+----------------------------------------+
76+
| original name=Palo, founding time=2008 |
77+
+----------------------------------------+
78+
```
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
{
3+
"title": "AI_FILTER",
4+
"language": "en"
5+
}
6+
---
7+
8+
<!--
9+
Licensed to the Apache Software Foundation (ASF) under one
10+
or more contributor license agreements. See the NOTICE file
11+
distributed with this work for additional information
12+
regarding copyright ownership. The ASF licenses this file
13+
to you under the Apache License, Version 2.0 (the
14+
"License"); you may not use this file except in compliance
15+
with the License. You may obtain a copy of the License at
16+
17+
http://www.apache.org/licenses/LICENSE-2.0
18+
19+
Unless required by applicable law or agreed to in writing,
20+
software distributed under the License is distributed on an
21+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22+
KIND, either express or implied. See the License for the
23+
specific language governing permissions and limitations
24+
under the License.
25+
-->
26+
27+
## Description
28+
29+
Filters text based on given conditions.
30+
31+
## Syntax
32+
33+
```sql
34+
AI_FILTER([<resource_name>], <text>)
35+
```
36+
37+
## Parameters
38+
39+
| Parameter | Description |
40+
|-------------------|-----------------------------------|
41+
| `<resource_name>` | The specified resource name, optional |
42+
| `<text>` | The information to be evaluated |
43+
44+
## Return Value
45+
46+
Returns a boolean value.
47+
48+
If any input is NULL, returns NULL.
49+
50+
The result is generated by the large language model, so the output may not be fixed.
51+
52+
## Example
53+
54+
Suppose you have the following table representing comments received by a courier company:
55+
```sql
56+
CREATE TABLE user_comments (
57+
id INT,
58+
comment VARCHAR(500)
59+
) DUPLICATE KEY(id)
60+
DISTRIBUTED BY HASH(id) BUCKETS 10
61+
PROPERTIES (
62+
"replication_num" = "1"
63+
);
64+
```
65+
66+
If you want to query the positive comments, you can use:
67+
```sql
68+
SELECT id, comment FROM user_comments
69+
WHERE AI_FILTER('resource_name', CONCAT('This is a positive comment: ', comment));
70+
```
71+
72+
The result may look like:
73+
```text
74+
+------+--------------------------------------------+
75+
| id | comment |
76+
+------+--------------------------------------------+
77+
| 1 | Absolutely fantastic, highly recommend it. |
78+
| 3 | This product is amazing and I love it. |
79+
+------+--------------------------------------------+
80+
```
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
{
3+
"title": "AI_FIXGRAMMAR",
4+
"language": "en"
5+
}
6+
---
7+
8+
<!--
9+
Licensed to the Apache Software Foundation (ASF) under one
10+
or more contributor license agreements. See the NOTICE file
11+
distributed with this work for additional information
12+
regarding copyright ownership. The ASF licenses this file
13+
to you under the Apache License, Version 2.0 (the
14+
"License"); you may not use this file except in compliance
15+
with the License. You may obtain a copy of the License at
16+
17+
http://www.apache.org/licenses/LICENSE-2.0
18+
19+
Unless required by applicable law or agreed to in writing,
20+
software distributed under the License is distributed on an
21+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22+
KIND, either express or implied. See the License for the
23+
specific language governing permissions and limitations
24+
under the License.
25+
-->
26+
27+
## Description
28+
29+
Used to correct grammatical errors in text.
30+
31+
## Syntax
32+
33+
```sql
34+
AI_FIXGRAMMAR([<resource_name>], <text>)
35+
```
36+
37+
## Parameters
38+
39+
| Parameter | Description |
40+
| ----------------- | ------------------------------------------- |
41+
| `<resource_name>` | The specified resource name, optional |
42+
| `<text>` | The text to be grammar-corrected |
43+
44+
## Return Value
45+
46+
Returns the text string after grammar correction.
47+
48+
If any input is NULL, returns NULL.
49+
50+
The result is generated by a large language model, so the output may vary.
51+
52+
## Examples
53+
54+
```sql
55+
SET default_ai_resource = 'resource_name';
56+
SELECT AI_FIXGRAMMAR('Apache Doris a great system DB') AS Result;
57+
```
58+
```text
59+
+------------------------------------------+
60+
| Result |
61+
+------------------------------------------+
62+
| Apache Doris is a great database system. |
63+
+------------------------------------------+
64+
```
65+
66+
```sql
67+
SELECT AI_FIXGRAMMAR('resource_name', 'I am like to using Doris') AS Result;
68+
```
69+
```text
70+
+--------------------+
71+
| Result |
72+
+--------------------+
73+
| I like using Doris |
74+
+--------------------+
75+
```

0 commit comments

Comments
 (0)