with a as (
select null as c1
,2 as c2
union all
select 0 as c1
,2 as c2
union all
select 0 as c1
,2 as c2
)
select collect_set(c1) as c_new from a group by c2
[‘0’]
select if( size(c_new )=1,null,if(c_new [0]='0',c_new[1],c_new[0])) from b
null
with a as (
select 1 as c1
,2 as c2
union all
select 0 as c1
,2 as c2
union all
select 0 as c1
,2 as c2
)
select collect_set(c1) as c_new from a group by c2
[1,0]
select if( size(c_new )=1,null,if(c_new [0]=0,c_new[1],c_new[0])) from b
本文探讨了如何使用Python通过with aas()函数进行数据融合,并通过collect_set()和if语句处理不同情况下的数据。特别关注了0和1的特殊处理,以及对单值和多值结果的转换。
7978

被折叠的 条评论
为什么被折叠?



