标签:
使用说明:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF
map<string,string> |
str_to_map(text[, delimiter1, delimiter2]) |
Splits text into key-value pairs using two delimiters. Delimiter1 separates text into K-V pairs, and Delimiter2 splits each K-V pair. Default delimiters are ‘,‘ for delimiter1 and ‘=‘ for delimiter2. |
案例1:
hive>
> select str_to_map(‘aaa:11&bbb:22‘, ‘&‘, ‘:‘)
> from tmp.tmp_jzl_20140725_test11;
OK
{"bbb":"22","aaa":"11"}
案例2:
hive> select str_to_map(‘aaa:11&bbb:22‘, ‘&‘, ‘:‘)[‘aaa‘]
> from tmp.tmp_jzl_20140725_test11;
OK
11
标签:
原文地址:http://my.oschina.net/repine/blog/529562