to_map


to_map(key, value) – Convert two aggregated columns into a key-value map

WITH input as (
select ‘aaa’ as key, 111 as value
UNION all
select ‘bbb’ as key, 222 as value
)
select to_map(key, value)
from input;

> {“bbb”:222,”aaa”:111}

Platforms: WhereOS, Spark, Hive
Class: hivemall.tools.map.UDAFToMap

More functions can be added to WhereOS via Python or R bindings or as Java & Scala UDF (user-defined function), UDAF (user-defined aggregation function) and UDTF (user-defined table generating function) extensions. Custom libraries can be added on via Settings-page or installed from WhereOS Store.

Leave a Reply