#### /tags/release-0.0.0-rc0/hive/external/ql/src/test/queries/clientpositive/str_to_map.q

#
text | 26 lines | 18 code | 8 blank | 0 comment | 0 complexity | 69a17a4df4dcb4726db3d146de778bb8 MD5 | raw file
``` 1desc function str_to_map;
2desc function extended str_to_map;
3
4explain select str_to_map('a=1,b=2,c=3',',','=')['a'] from src limit 3;
5select str_to_map('a=1,b=2,c=3',',','=')['a'] from src limit 3;
6
7explain select str_to_map('a:1,b:2,c:3') from src limit 3;
8select str_to_map('a:1,b:2,c:3') from src limit 3;
9
10explain select str_to_map('a:1,b:2,c:3',',',':') from src limit 3;
11select str_to_map('a:1,b:2,c:3',',',':') from src limit 3;
12
13explain select str_to_map(t.ss,',',':')['a']
14from (select transform('a:1,b:2,c:3') using 'cat' as (ss) from src) t
15limit 3;
16select str_to_map(t.ss,',',':')['a']
17from (select transform('a:1,b:2,c:3') using 'cat' as (ss) from src) t
18limit 3;
19
20
21drop table tbl_s2m;
22create table tbl_s2m as select 'ABC=CC_333=444' as t from src limit 3;
23
24select str_to_map(t,'_','=')['333'] from tbl_s2m;
25
26drop table tbl_s2m;
```