gpt4 book ai didi

hadoop - 如何在配置单元中获取数组中的不同元素

转载 作者:可可西里 更新时间:2023-11-01 14:42:34 25 4
gpt4 key购买 nike

我有一个表,其中有一列类型为 array<bigint>每行具有动态大小。示例:

          1  [100,200] 
2 [100,300,500,600]
3 [200,300]

结果应该是与数组的这一列不同的值,应该是

100
200
300
500
600

最佳答案

你必须使用 explode(<column name>) , 然后申请 distinct在子查询上,类似于:

select distinct a.conver from (
select explode(arr) as conver from arraytype2
) as a

然后您可以使用 collect_list将其转换回 array .

关于hadoop - 如何在配置单元中获取数组中的不同元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33800947/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com