Skip to content

Commit 67a6e96

Browse files
b41shsoyeric128
andauthored
docs: add map and array functions (#1644)
* docs: add map and array functions * fix --------- Co-authored-by: Eric <[email protected]>
1 parent 0dc85f7 commit 67a6e96

File tree

7 files changed

+153
-10
lines changed

7 files changed

+153
-10
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: ARRAYS_ZIP
3+
---
4+
import FunctionDescription from '@site/src/components/FunctionDescription';
5+
6+
<FunctionDescription description="Introduced or updated: v1.2.690"/>
7+
8+
Merges multiple arrays into a single array tuple.
9+
10+
## Syntax
11+
12+
```sql
13+
ARRAYS_ZIP( <array1> [, ...] )
14+
```
15+
16+
## Arguments
17+
18+
| Arguments | Description |
19+
|------------|-------------------|
20+
| `<arrayN>` | The input ARRAYs. |
21+
22+
:::note
23+
- The length of each array must be the same.
24+
:::
25+
26+
## Return Type
27+
28+
Array(Tuple).
29+
30+
## Examples
31+
32+
```sql
33+
SELECT ARRAYS_ZIP([1, 2, 3], ['a', 'b', 'c']);
34+
┌────────────────────────────────────────┐
35+
│ arrays_zip([1, 2, 3], ['a', 'b', 'c']) │
36+
├────────────────────────────────────────┤
37+
│ [(1,'a'),(2,'b'),(3,'c')] │
38+
└────────────────────────────────────────┘
39+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: ST_GEOMETRYFROMTEXT
3+
---
4+
5+
Alias for [ST_GEOMETRYFROMWKT](st-geometryfromwkt.md).

docs/en/sql-reference/20-sql-functions/09-geometry-functions/st-geometryfromwkt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ST_GEOMETRYFROMWKT(<string>, [<srid>])
1919
- [ST_GEOMETRYFROMEWKT](st-geometryfromewkt.md)
2020
- [ST_GEOMFROMEWKT](st-geomfromewkt.md)
2121
- [ST_GEOMFROMTEXT](st-geomfromtext.md)
22-
- [ST_GEOMTRYFROMTEXT](st-geomtryfromtext.md)
22+
- [ST_GEOMETRYFROMTEXT](st-geometryfromtext.md)
2323

2424
## Arguments
2525

docs/en/sql-reference/20-sql-functions/09-geometry-functions/st-geomtryfromtext.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/en/sql-reference/20-sql-functions/10-map-functions/map-delete.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ Returns an existing MAP with one or more keys removed.
1111

1212
```sql
1313
MAP_DELETE( <map>, <key1> [, <key2>, ... ] )
14+
MAP_DELETE( <map>, <array> )
1415
```
1516

1617
## Arguments
1718

18-
| Arguments | Description |
19-
|-----------|----------------------------------------------|
20-
| `<map>` | The MAP that contains the KEY to remove. |
21-
| `<keyN>` | The KEY to be omitted from the returned MAP. |
19+
| Arguments | Description |
20+
|-----------|--------------------------------------------------------|
21+
| `<map>` | The MAP that contains the KEY to remove. |
22+
| `<keyN>` | The KEYs to be omitted from the returned MAP. |
23+
| `<array>` | The Array of KEYs to be omitted from the returned MAP. |
2224

2325
:::note
2426
- The types of the key expressions and the keys in the map must be the same.
@@ -38,4 +40,11 @@ SELECT MAP_DELETE({'a':1,'b':2,'c':3}, 'a', 'c');
3840
├───────────────────────────────────────────┤
3941
│ {'b':2} │
4042
└───────────────────────────────────────────┘
43+
44+
SELECT MAP_DELETE({'a':1,'b':2,'c':3}, ['a', 'b']);
45+
┌─────────────────────────────────────────────┐
46+
│ map_delete({'a':1,'b':2,'c':3}, ['a', 'b']) │
47+
├─────────────────────────────────────────────┤
48+
│ {'c':3} │
49+
└─────────────────────────────────────────────┘
4150
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: MAP_INSERT
3+
---
4+
import FunctionDescription from '@site/src/components/FunctionDescription';
5+
6+
<FunctionDescription description="Introduced or updated: v1.2.654"/>
7+
8+
Returns a new MAP consisting of the input MAP with a new key-value pair inserted (an existing key updated with a new value).
9+
10+
## Syntax
11+
12+
```sql
13+
MAP_INSERT( <map>, <key>, <value> [, <updateFlag> ] )
14+
```
15+
16+
## Arguments
17+
18+
| Arguments | Description |
19+
|----------------|----------------------------------------------------------------------------------------------|
20+
| `<map>` | The input MAP. |
21+
| `<key>` | The new key to insert into the MAP. |
22+
| `<value>` | The new value to insert into the MAP. |
23+
| `<updateFlag>` | The boolean flag indicates whether an existing key can be overwritten. The default is FALSE. |
24+
25+
## Return Type
26+
27+
Map.
28+
29+
## Examples
30+
31+
```sql
32+
SELECT MAP_INSERT({'a':1,'b':2,'c':3}, 'd', 4);
33+
┌─────────────────────────────────────────┐
34+
│ map_insert({'a':1,'b':2,'c':3}, 'd', 4) │
35+
├─────────────────────────────────────────┤
36+
│ {'a':1,'b':2,'c':3,'d':4} │
37+
└─────────────────────────────────────────┘
38+
39+
SELECT MAP_INSERT({'a':1,'b':2,'c':3}, 'a', 5, true);
40+
┌───────────────────────────────────────────────┐
41+
│ map_insert({'a':1,'b':2,'c':3}, 'a', 5, TRUE) │
42+
├───────────────────────────────────────────────┤
43+
│ {'a':5,'b':2,'c':3} │
44+
└───────────────────────────────────────────────┘
45+
```
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: MAP_PICK
3+
---
4+
import FunctionDescription from '@site/src/components/FunctionDescription';
5+
6+
<FunctionDescription description="Introduced or updated: v1.2.654"/>
7+
8+
Returns a new MAP containing the specified key-value pairs from an existing MAP.
9+
10+
## Syntax
11+
12+
```sql
13+
MAP_PICK( <map>, <key1> [, <key2>, ... ] )
14+
MAP_PICK( <map>, <array> )
15+
```
16+
17+
## Arguments
18+
19+
| Arguments | Description |
20+
|-----------|-------------------------------------------------------- |
21+
| `<map>` | The input MAP. |
22+
| `<keyN>` | The KEYs to be included from the returned MAP. |
23+
| `<array>` | The Array of KEYs to be included from the returned MAP. |
24+
25+
:::note
26+
- The types of the key expressions and the keys in the map must be the same.
27+
- Key values not found in the map will be ignored.
28+
:::
29+
30+
## Return Type
31+
32+
Map.
33+
34+
## Examples
35+
36+
```sql
37+
SELECT MAP_PICK({'a':1,'b':2,'c':3}, 'a', 'c');
38+
┌─────────────────────────────────────────┐
39+
│ map_pick({'a':1,'b':2,'c':3}, 'a', 'c') │
40+
├─────────────────────────────────────────┤
41+
│ {'a':1,'c':3} │
42+
└─────────────────────────────────────────┘
43+
44+
SELECT MAP_PICK({'a':1,'b':2,'c':3}, ['a', 'b']);
45+
┌───────────────────────────────────────────┐
46+
│ map_pick({'a':1,'b':2,'c':3}, ['a', 'b']) │
47+
├───────────────────────────────────────────┤
48+
│ {'a':1,'b':2} │
49+
└───────────────────────────────────────────┘
50+
```

0 commit comments

Comments
 (0)