我有一列类型为 array<bigint>
(比如值 [1,2,3,4](,我想将其转换为string
(比如"1,2,3,4"(,我该怎么做?
我试过concat_ws(',' arr)
,但它抱怨
Argument 2 of function CONCAT_WS must be "string or array<string>", but "array<bigint>" was found."
有没有办法将array<bigint>
投射到array<string>
?
试试这个:
select xx,concat_ws(',',collect_set(cast(element as string))) as arrystr
from table
lateral view explode(arr) b as element
group by xx
试试这个:
select
regexp_replace(string_with_brackets,'\[|\]','') as final_str
from
(
select
transform(array_of_int) using '/bin/cat' as (string_with_brackets)
)