栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

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

项目场景:

在进行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!!!
结束

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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/583922.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号