Hive No partition predicate found for Alias xxx 解决方案

 No partition predicate found for Alias "b" Table "user_browse_region"

在Hive中联表查询,数据量比较大,对一个表指定了分区字段,而另一个是放到联表查询的条件,导致报错。

出错的sql:

select count(a.user_id), count(distinct a.user_id) from ugc_action_raw a join user b on a.user_id=b.id join user_browse_region c on a.user_id=c.id and a.log_date=c.log_date where a.ugc_type=0 and b.gender='男生' and b.stage='20' and c.region='北京' and a.log_date='2012-09-11';

原因分析:没有对c表指定分区字段。

解决方案:联表查询的条件中去掉a.log_date=c.log_date,在后面的where语句中加上c.log_date='2012-09-11';

正确的sql:

select count(a.user_id), count(distinct a.user_id) from ugc_action_raw a join user b on a.user_id=b.id join user_browse_region c on a.user_id=c.id where a.ugc_type=0 and b.gender='男生' and b.stage='20' and c.region='北京' and a.log_date='2012-09-11' and c.log_date='2012-09-11';

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值