如何绕过ODPS不支持的笛卡尔积的限制Cartesian product is not allowed without map join

如何绕过ODPS不支持的笛卡尔积的限制

需求情景再现

with tmp1 as (
select '保定五洲长城大街店' as a,'华北战区' as c
union all
select '新疆五洲乌鲁木齐店' as a,'西北战区' as c
)
,
tmp2 as (
select '保定五洲' as b
union
select '廊坊五洲' as b
)

--现在需求想把战区给tmp2表拼上
select tmp2.b ,tmp1.c from tmp1 join tmp2 on tmp1.a like concat('%',tmp2.b,'%')

odps不支持无 on 的 join 会报

*ODPS-0130252 Cartesian product is not allowed without map join *的错误

 

可以往select里增加字段来绕过这个限制

with tmp1 as (
select '保定五洲长城大街店' as a,'华北战区' as c
union all
select '新疆五洲乌鲁木齐店' as a,'西北战区' as c
)
,
tmp2 as (
select '保定五洲' as b
union
select '廊坊五洲' as b
)
select tmp22.b ,tmp11.c from
 (select *,1 as raoguo from tmp1) tmp11 
join (select * ,1 as raoguo from tmp2) tmp22
 on tmp11.raoguo =tmp22.raoguo
 and  tmp11.a like concat('%',tmp22.b,'%')

你可能感兴趣的:(大数据相关资料,算法,hive,big,data)