sparksql案例实操
sparksql案例实操解决语句如下
select
*
from(
select
,
rank()over(partition by area order by clickCnt desc)
from(select
area,
product_name,
count()as clickCnt
from(
select
a.*,
p.product_name,
c.area,
c.city_name
from user_visit_action a
join product_info p on a.click_product_id=p.product_id
join city_info c on a.city_id=c.city_id
where a.click_product_id>-1
)t1 group by area,product_name
)t2
)t3 where rank<=3;