ClickHouse / ClickHouse/ClickHouse
Casting a Map to an Array of Tuple
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
For example I'd like to turn a `values Map(String, Int64)` to `Array(Tuple(String, Int64))`,
Two approaches that work on my side
1. `arrayZip(mapKeys(values), mapValues(values))`
I didn't find the doc specifying the order of mapKeys and mapValues will be the same or will even be in the order of the insertion though I think it is because there's a [mapSort](https://clickhouse.com/docs/en/sql-reference/functions/tuple-map-functions#mapsortfunc-map).
3. `cast(values, 'Array(Tuple(String, Int64))')`
No doc specifying this would work as my expect.
Regarding the behavior and the performance, which approach would you recommend? Is it a good idea to have independent functions to extract a Map to an `Array(Tuple(k, v))` or `Tuple(ks Array, vs Array)`?
Contributor guide
Assessment
This issue has not been assessed yet.