No matching method for class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPDivide with (bigint,b

No matching method for class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPDivide with (bigint,b,第1张

No matching method for class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPDivide with (bigint,b 项目场景:

在进行hive建表的时候出现的问题
FAILED: SemanticException [Error 10014]: Line 23:68 Wrong arguments ‘sau_kpimrcnt’: No matching method for class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPDivide with (bigint, boolean)

问题描述:
FAILED: SemanticException [Error 10014]: Line 23:68 Wrong arguments 'sau_kpimrcnt': No matching method for class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPDivide with (bigint, boolean)

原因分析:

在我使用的insert+select语句中,我想直接在外层出一个字段,于是我就萌生了这样的想法

,case when round((sum(xxx)/sum(xxx),4)>80 then 0
when round((sum(xxx)/sum(xxx),4)>60 then 1
else 2 end as da

这个地方我一开始并不觉得有问题,于是我就这样执行,但是发现一直报上面的那个错误,后面我就去查了查,发现好像没有这种写法,就只有这种写法

sum(case when ...then ..
	when ...)

解决方案:

这里如何解决就是,你只需要在里层把他封装一下下
就是像这样
xxx字段,yyy表

insert overwrite table yyy partition(xxx)
select 
xxx
,xxx
,case when a>80 then 0
when a>60 then 1
else 2 end as da
from(
select 
round((sum(xxx)/sum(xxx),4) as a
,xxx
,xxx
from yyy 
where (这里一般跟分区字段)
group by ...) da
group by
...

这里的where和group by是看具体情况而定的,里层出来最好去别名,当你的层数多了可以很好的分清。
ok!!!
结束

注:文中如有错误部分,还劳烦指正,谢谢哦。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5575132.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-14
下一篇 2022-12-14

发表评论

登录后才能评论

评论列表(0条)

保存