-
Notifications
You must be signed in to change notification settings - Fork 414
[Feature](docs) Impl the function map_concat like spark #3220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nagisa-kunhah
wants to merge
12
commits into
apache:master
Choose a base branch
from
nagisa-kunhah:feat_mapconcat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
572ff4e
feat: mapconcat
nagisa-kunhah 7e70ef4
feat: map-concat doc
nagisa-kunhah 999d44b
feat: sidebar of map-concat
nagisa-kunhah 27a40b8
Merge branch 'master' into feat_mapconcat
nagisa-kunhah 2587fab
fix: map concat
nagisa-kunhah e35ac65
fix: info
nagisa-kunhah a16e18a
fix: doc
nagisa-kunhah f046b3b
fix: doc
nagisa-kunhah 5a8a51c
fix: chinese
nagisa-kunhah 7a3fcdf
fix: doc
nagisa-kunhah 2c695e6
fix: doc
nagisa-kunhah bc11456
remove: map-concat of current version
nagisa-kunhah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
docs/sql-manual/sql-functions/scalar-functions/map-functions/map-concat.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| { | ||
| "title": "MAP_CONCAT", | ||
| "language": "en" | ||
| } | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| Concatenates multiple maps into a single map. | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```sql | ||
| MAP_CONCAT(<map1> [, <map2> [, <map3> ... ]]) | ||
| ``` | ||
|
|
||
| ## Parameters | ||
| - `<map1>`, `<map2>`, `<map3>`, ...: [`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) type, the input maps to concatenate. | ||
|
|
||
| ## Return Value | ||
| Returns a concatenated `MAP` containing all key-value pairs from the input maps. | ||
|
|
||
| ## Usage Notes | ||
| 1. The function accepts zero or more map arguments. | ||
| 2. If any argument is NULL, the result is NULL. | ||
|
|
||
| ## Examples | ||
| 1. Basic usage | ||
| ```sql | ||
| select map_concat() as empty_map; | ||
| ``` | ||
| ```text | ||
| +-----------+ | ||
| | empty_map | | ||
| +-----------+ | ||
| | {} | | ||
| +-----------+ | ||
| ``` | ||
|
|
||
| ```sql | ||
| select map_concat(map('single', 'argument')) as single_argument; | ||
| ``` | ||
| ```text | ||
| +-----------------+ | ||
| | single_argument | | ||
| +-----------------+ | ||
| | {"single":"argument"} | | ||
| +-----------------+ | ||
| ``` | ||
|
|
||
| ```sql | ||
| select map_concat({'a': 'apple'}, {'b': 'banana'}, {'c': 'cherry'}) as literal_maps_merged; | ||
| ``` | ||
| ```text | ||
| +-------------------------------+ | ||
| | literal_maps_merged | | ||
| +-------------------------------+ | ||
| | {"a":"apple", "b":"banana", "c":"cherry"} | | ||
| +-------------------------------+ | ||
| ``` | ||
|
|
||
| 2. NULL parameters | ||
| ```sql | ||
| select map_concat({'a': 'apple'}, NULL) as with_null; | ||
| ``` | ||
| ```text | ||
| +------------+ | ||
| | with_null | | ||
| +------------+ | ||
| | NULL | | ||
| +------------+ |
79 changes: 79 additions & 0 deletions
79
...rsion-4.x/sql-manual/sql-functions/scalar-functions/map-functions/map-concat.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| --- | ||
| { | ||
| "title": "MAP_CONCAT", | ||
| "language": "zh-CN" | ||
| } | ||
| --- | ||
|
|
||
| ## 描述 | ||
|
|
||
| 将多个 map 合并为一个 map。 | ||
|
|
||
| ## 语法 | ||
|
|
||
| ```sql | ||
| MAP_CONCAT(<map1> [, <map2> [, <map3> ... ]]) | ||
| ``` | ||
|
|
||
| ## 参数 | ||
|
|
||
| | 参数 | 说明 | | ||
| | -- | -- | | ||
| | `<map1>`, `<map2>`, `<map3>`, ... | [`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) 类型,需要合并的输入 map | | ||
|
|
||
| ## 返回值 | ||
|
|
||
| 返回一个合并后的 `MAP`,包含所有输入 map 中的键值对。 | ||
|
|
||
| ## 使用说明 | ||
|
|
||
| 1. 该函数接受零个或多个 map 参数。 | ||
| 2. 如果任何参数为 NULL,则结果为 NULL。 | ||
|
|
||
| ## 示例 | ||
|
|
||
| 1. 基本用法 | ||
| ```sql | ||
| select map_concat() as empty_map; | ||
| ``` | ||
| ```text | ||
| +-----------+ | ||
| | empty_map | | ||
| +-----------+ | ||
| | {} | | ||
| +-----------+ | ||
| ``` | ||
|
|
||
| ```sql | ||
| select map_concat(map('single', 'argument')) as single_argument; | ||
| ``` | ||
| ```text | ||
| +-----------------+ | ||
| | single_argument | | ||
| +-----------------+ | ||
| | {"single":"argument"} | | ||
| +-----------------+ | ||
| ``` | ||
|
|
||
| ```sql | ||
| select map_concat({'a': 'apple'}, {'b': 'banana'}, {'c': 'cherry'}) as literal_maps_merged; | ||
| ``` | ||
| ```text | ||
| +-------------------------------+ | ||
| | literal_maps_merged | | ||
| +-------------------------------+ | ||
| | {"a":"apple", "b":"banana", "c":"cherry"} | | ||
| +-------------------------------+ | ||
| ``` | ||
|
|
||
| 2. NULL 参数 | ||
| ```sql | ||
| select map_concat({'a': 'apple'}, NULL) as with_null; | ||
| ``` | ||
| ```text | ||
| +------------+ | ||
| | with_null | | ||
| +------------+ | ||
| | NULL | | ||
| +------------+ | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.