[ https://issues.apache.org/jira/browse/SPARK-23938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xiao Li updated SPARK-23938: ---------------------------- Description: Ref: https://prestodb.io/docs/current/functions/map.html Merges the two given maps into a single map by applying function to the pair of values with the same key. For keys only presented in one map, NULL will be passed as the value for the missing key. {noformat} SELECT map_zip_with(MAP(ARRAY[1, 2, 3], ARRAY['a', 'b', 'c']), -- {1 -> ad, 2 -> be, 3 -> cf} MAP(ARRAY[1, 2, 3], ARRAY['d', 'e', 'f']), (k, v1, v2) -> concat(v1, v2)); SELECT map_zip_with(MAP(ARRAY['k1', 'k2'], ARRAY[1, 2]), -- {k1 -> ROW(1, null), k2 -> ROW(2, 4), k3 -> ROW(null, 9)} MAP(ARRAY['k2', 'k3'], ARRAY[4, 9]), (k, v1, v2) -> (v1, v2)); SELECT map_zip_with(MAP(ARRAY['a', 'b', 'c'], ARRAY[1, 8, 27]), -- {a -> a1, b -> b4, c -> c9} MAP(ARRAY['a', 'b', 'c'], ARRAY[1, 2, 3]), (k, v1, v2) -> k || CAST(v1/v2 AS VARCHAR)); {noformat} was: Ref: https://prestodb.io/docs/current/functions/map.html Merges the two given maps into a single map by applying function to the pair of values with the same key. For keys only presented in one map, NULL will be passed as the value for the missing key. > High-order function: map_zip_with(map<K, V1>, map<K, V2>, function<K, V1, V2, > V3>) → map<K, V3> > ----------------------------------------------------------------------------------------------- > > Key: SPARK-23938 > URL: https://issues.apache.org/jira/browse/SPARK-23938 > Project: Spark > Issue Type: Sub-task > Components: SQL > Affects Versions: 2.3.0 > Reporter: Xiao Li > Priority: Major > > Ref: https://prestodb.io/docs/current/functions/map.html > Merges the two given maps into a single map by applying function to the pair > of values with the same key. For keys only presented in one map, NULL will be > passed as the value for the missing key. > {noformat} > SELECT map_zip_with(MAP(ARRAY[1, 2, 3], ARRAY['a', 'b', 'c']), -- {1 -> ad, 2 > -> be, 3 -> cf} > MAP(ARRAY[1, 2, 3], ARRAY['d', 'e', 'f']), > (k, v1, v2) -> concat(v1, v2)); > SELECT map_zip_with(MAP(ARRAY['k1', 'k2'], ARRAY[1, 2]), -- {k1 -> ROW(1, > null), k2 -> ROW(2, 4), k3 -> ROW(null, 9)} > MAP(ARRAY['k2', 'k3'], ARRAY[4, 9]), > (k, v1, v2) -> (v1, v2)); > SELECT map_zip_with(MAP(ARRAY['a', 'b', 'c'], ARRAY[1, 8, 27]), -- {a -> a1, > b -> b4, c -> c9} > MAP(ARRAY['a', 'b', 'c'], ARRAY[1, 2, 3]), > (k, v1, v2) -> k || CAST(v1/v2 AS VARCHAR)); > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org