我正在使用蜂巢 1.1
hive> select country from releases limit 1;
OK
["us","ca","fr"]
Run Code Online (Sandbox Code Playgroud)
现在 country 是 hive 中的 string 类型。如何将其转换为 Array[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
Run Code Online (Sandbox Code Playgroud)
有人可以帮我做类型转换吗?
hive> with releases as (select '["us","ca","fr"]' as country)
> select split(regexp_extract(country,'^\\["(.*)\\"]$',1),'","')
> from releases
> ;
OK
_c0
["us","ca","fr"]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10995 次 |
| 最近记录: |