hive报错积累

1 distinct

select
cast(a.teach_plan_id as bigint) as teach_plan_id,
cast(nvl(teach_activity_num ,0) as int) as teach_activity_num,
cast(nvl(knowledge_num,0) as int) as knowledge_num
from
(select distinct id as teach_plan_id from ods.ods_teachingplan where  dt='2021-02-20' and id is not null and del='N')a
left join
--教学活动数
(select teach_plan_id,count(distinct activity_id) as teach_activity_num from ods.ods_teachplan_content_item where  dt='2021-02-20' and  is_activity='true' and del='N' group by teach_plan_id)b on a.teach_plan_id=b.teach_plan_id
left join
--知识点数量统计
(select teach_plan_id,count(distinct knowledge_id) as knowledge_num from ods.ods_teachingplan_knowledge where  dt='2021-02-20' and  del='N' group by teach_plan_id)c on a.teach_plan_id= c.teach_plan_id

报错

java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row (tag=0) {"key":{"_col0":"3462800421816365056"},"value":null}
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: org.apache.hadoop.hive.ql.metadata.HiveException: Attempting to overwrite nextKeyWritables[2]

解决办法:
删掉a表的distinct.(因a表的id其实是唯一的)
借鉴帖子:
https://blog.youkuaiyun.com/UncleMing5371/article/details/85236709?spm=1001.2014.3001.5506

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

独狐游清湖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值