hive如何将数组转成字符串_如何在Hive中将字符串转换为
Array?
I am using hive 1.1
hive> select country from releases limit 1;
OK
["us","ca","fr"]
For now country is of type string in hive . How do I convert that into Array[String]?
I tried the below, but it is throwing error
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
Can someone help me to do the typecasting?
解决⽅案hive> with releases as (select '["us","ca","fr"]' as country)
> select split(regexp_extract(country,'^\\["(.*)\\"]$',1),'","')
> from releases
> ;
数组转换成字符串OK
_c0
["us","ca","fr"]

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。