[ 
https://issues.apache.org/jira/browse/FLINK-32261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hanyu Zheng updated FLINK-32261:
--------------------------------
    Description: 
Description:

This is an implementation of MAP_UNION 

Returns a map created by merging two maps, 'map1' and 'map2'. This two maps 
should have same data structure. If there are overlapping keys, the value from 
'map2' will overwrite the value from 'map1'. If any of maps are null, return 
null.

Syntax:

`MAP_UNION(map1, map2)`

Arguments:
 * map1:The first map to be merged.
 * map2:The second map to be merged.

Returns: A new map that contains the combined key-value pairs from {{map1}} and 
map{{{}2{}}}. If there are any overlapping keys, the value from {{map2}} will 
overwrite the value from {{{}map1{}}}.

Examples:

 Merging maps with unique keys:

 
{code:java}
map1 = ['a': 1, 'b': 2] map2 = ['c': 3, 'd': 4] 
map_union[map1, map2]  
Output: ['a': 1, 'b': 2, 'c': 3, 'd': 4]{code}
 Merging maps with overlapping keys:

 
 
{code:java}
map1 = ['a': 1, 'b': 2] map2 = ['b': 3, 'c': 4] 
map_union[map1, map2] 
Output: ['a': 1, 'b': 3, 'c': 4]{code}
See also:

prestodb: [https://prestodb.io/docs/current/functions/aggregate.html]

 

 

  was:
Description:

The current implementation of the {{map_union}} method in the Flink library 
does not provide a way to combine two dictionaries into a single dictionary. 
This enhancement aims to add this functionality, allowing users to merge 
dictionaries efficiently.

Syntax:

 
{code:java}
map_union[map1: map, map2: map] -> map{code}
Arguments:
 * map1:The first map to be merged.
 * map2:The second map to be merged.

Returns: A new map that contains the combined key-value pairs from {{map1}} and 
map{{{}2{}}}. If there are any overlapping keys, the value from {{map2}} will 
overwrite the value from {{{}map1{}}}.

Examples:

 Merging maps with unique keys:

 
{code:java}
map1 = ['a': 1, 'b': 2] map2 = ['c': 3, 'd': 4] result = map_union(map1, map2)  
Output: ['a': 1, 'b': 2, 'c': 3, 'd': 4]{code}
 Merging maps with overlapping keys:

 
 
{code:java}
map1 = ['a': 1, 'b': 2] dict2 = ['b': 3, 'c': 4] result = map_union[dict1, 
dict2] Output: ['a': 1, 'b': 3, 'c': 4]{code}
See also:

prestodb: [https://prestodb.io/docs/current/functions/aggregate.html]

 

 


> Add MAP_UNION support in SQL & Table API
> ----------------------------------------
>
>                 Key: FLINK-32261
>                 URL: https://issues.apache.org/jira/browse/FLINK-32261
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>    Affects Versions: 1.18.0
>            Reporter: Bonnie Varghese
>            Assignee: Hanyu Zheng
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.18.0
>
>
> Description:
> This is an implementation of MAP_UNION 
> Returns a map created by merging two maps, 'map1' and 'map2'. This two maps 
> should have same data structure. If there are overlapping keys, the value 
> from 'map2' will overwrite the value from 'map1'. If any of maps are null, 
> return null.
> Syntax:
> `MAP_UNION(map1, map2)`
> Arguments:
>  * map1:The first map to be merged.
>  * map2:The second map to be merged.
> Returns: A new map that contains the combined key-value pairs from {{map1}} 
> and map{{{}2{}}}. If there are any overlapping keys, the value from {{map2}} 
> will overwrite the value from {{{}map1{}}}.
> Examples:
>  Merging maps with unique keys:
>  
> {code:java}
> map1 = ['a': 1, 'b': 2] map2 = ['c': 3, 'd': 4] 
> map_union[map1, map2]  
> Output: ['a': 1, 'b': 2, 'c': 3, 'd': 4]{code}
>  Merging maps with overlapping keys:
>  
>  
> {code:java}
> map1 = ['a': 1, 'b': 2] map2 = ['b': 3, 'c': 4] 
> map_union[map1, map2] 
> Output: ['a': 1, 'b': 3, 'c': 4]{code}
> See also:
> prestodb: [https://prestodb.io/docs/current/functions/aggregate.html]
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to