Skip to content

Commit f56a2ef

Browse files
authored
doc: Add support for map and make_map functions (#11799)
* doc: Add support for `map` and `make_map` functions * chore: Add example for MAP
1 parent 0417e54 commit f56a2ef

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

docs/source/user-guide/sql/scalar_functions.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,6 +3636,70 @@ Unwraps struct fields into columns.
36363636
+-----------------------+-----------------------+
36373637
```
36383638

3639+
## Map Functions
3640+
3641+
- [map](#map)
3642+
- [make_map](#make_map)
3643+
3644+
### `map`
3645+
3646+
Returns an Arrow map with the specified key-value pairs.
3647+
3648+
```
3649+
map(key, value)
3650+
map(key: value)
3651+
```
3652+
3653+
#### Arguments
3654+
3655+
- **key**: Expression to be used for key.
3656+
Can be a constant, column, or function, any combination of arithmetic or
3657+
string operators, or a named expression of previous listed.
3658+
- **value**: Expression to be used for value.
3659+
Can be a constant, column, or function, any combination of arithmetic or
3660+
string operators, or a named expression of previous listed.
3661+
3662+
#### Example
3663+
3664+
```
3665+
SELECT MAP(['POST', 'HEAD', 'PATCH'], [41, 33, null]);
3666+
----
3667+
{POST: 41, HEAD: 33, PATCH: }
3668+
3669+
SELECT MAP([[1,2], [3,4]], ['a', 'b']);
3670+
----
3671+
{[1, 2]: a, [3, 4]: b}
3672+
3673+
SELECT MAP { 'a': 1, 'b': 2 };
3674+
----
3675+
{a: 1, b: 2}
3676+
```
3677+
3678+
### `make_map`
3679+
3680+
Returns an Arrow map with the specified key-value pairs.
3681+
3682+
```
3683+
make_map(key_1, value_1, ..., key_n, value_n)
3684+
```
3685+
3686+
#### Arguments
3687+
3688+
- **key_n**: Expression to be used for key.
3689+
Can be a constant, column, or function, any combination of arithmetic or
3690+
string operators, or a named expression of previous listed.
3691+
- **value_n**: Expression to be used for value.
3692+
Can be a constant, column, or function, any combination of arithmetic or
3693+
string operators, or a named expression of previous listed.
3694+
3695+
#### Example
3696+
3697+
```
3698+
SELECT MAKE_MAP('POST', 41, 'HEAD', 33, 'PATCH', null);
3699+
----
3700+
{POST: 41, HEAD: 33, PATCH: }
3701+
```
3702+
36393703
## Hashing Functions
36403704

36413705
- [digest](#digest)

0 commit comments

Comments
 (0)