我有一个类型为
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)
)