原始数据
address |
source |
台湾,上海,北京 |
table1 |
黑龙江,吉林,辽宁 |
table2 |
例如:下面的sql语句
select
address_new as address,
'new_address' as source
from
th_rw.dwd_th3_new_source_address_all dtaa
lateral view explode(split(address,',')) t as address_new
where
`source` = 'dwd_tw_huji_aft_8'
and
address like '%,%'
经过sql语句转换之后
address |
source |
台湾 |
table1 |
上海 |
table1 |
北京 |
table1 |
黑龙江 |
table2 |
吉林 |
table2 |
辽宁 |
table2 |
按照数据量对数据进行分区展示
select
address,
case when rank<=1200000 then 'ods_dzs_person_1'
when rank<=2400000 then 'ods_dzs_person_2'
when rank<=3600000 then 'ods_dzs_person_3'
when rank<=4800000 then 'ods_dzs_person_4'
when rank<=6000000 then 'ods_dzs_person_5'
when rank<=7200000 then 'ods_dzs_person_6'
when rank<=8400000 then 'ods_dzs_person_7'
when rank<=9600000 then 'ods_dzs_person_8'
else 'ods_dzs_person_9' end as source
from
(
select address, row_number() over (partition by source order by address) as rank
from dwd_th3_new_source_address_all88
where source = 'ods_dzs_person'
)
网友评论