我使用的是蜂巢1.1
hive> select country from releases limit 1;
OK
["us","ca","fr"]
目前,国家在 hive 中是字符串类型。如何将其转换为数组[String]?
我尝试了下面的方法,但它抛出错误
hive> select country, cast(country as Array[String]) from releases limit 1;
FAILED: ParseException line 1:48 cannot recognize input near 'Array' '[' 'String' in primitive type specification
有人可以帮我做打字吗?
hive> with releases as (select '["us","ca","fr"]' as country)
> select split(regexp_extract(country,'^\\["(.*)\\"]$',1),'","')
> from releases
> ;
OK
_c0
["us","ca","fr"]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)