使用hive OPTION SQL_SELECT_LIMIT=DEFAULT


安装完CDH,使用hive的时候报错:

FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: org.apache.hadoop.hive.ql.metadata.HiveException: MetaException(message:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1)

原因: 
/opt/cloudera/parcels/CDH/lib/hive/lib/mysql-connector-java-5.1.15.jar 

中用的mysql驱动版本 

mysql数据库版本为5.6 

hadoop是通过jdbc连接数据库,在连接数据库时候会发送测试语句SET OPTION SQL_SELECT_LIMIT=DEFAULT 
这在mysql5.6以下版本是可以的 ,但是5.6不再支持SET OPTION SQL_SELECT_LIMIT=DEFAULT 


解决:

mysql-connector-java-5.1.42-bin.jar

推荐文章:http://jackyrong.iteye.com/blog/2110569

修改完整版的sql存储(积分兑换脚本),改写出可执行的shell和hive脚本。 积分兑换脚本: create procedure "rptdev"."sp_wjq_jf_value_dhfz_show"( in @data_date integer default cast("dateformat"("now"()-1,'yyyymmdd') as integer), in @is_run_flag1 integer default 1, in @is_run_flag2 integer default 10 ) on exception resume /****************************************************************** -- Purpose : 兑换积分分析报表 -- Auther: xxx -- Date : 20210923 *******************************************************************/ begin declare @stat_date varchar(8); --统计日期 declare @month_id integer; --统计月份 declare @month_first_date varchar(8); --统计月的第一天 declare @month_last_date varchar(8); --统计月的最后一天 declare @last_month_first_date varchar(8); --上月的第一天 declare @last_month_last_date varchar(8); --上月的最后一天 declare @last_month integer; --上月 declare @last_last_month integer; --上上月 declare @last_month_this_day varchar(8); --上月当天 declare @last_year_this_month integer; --上年当月 declare @this_year_first_month integer; --本年首月 declare @last_year_last_month integer; --上年尾月 set @stat_date = convert(varchar(8),@data_date); set @month_id = @data_date/100; set @month_first_date = "dateformat"(@data_date,'yyyymm01'); --统计月的第一天 set @month_last_date = "dateformat"("dateadd"("dd",-1,"dateformat"("dateadd"("mm",1,@data_date),'yyyymm01')),'yyyymmdd'); --统计月的最后一天 set @last_month_first_date = "dateformat"("dateadd"("mm",-1,@data_date),'yyyymm01'); --上月第一天 set @last_month_last_date = "dateformat"("dateadd"("dd",-1,"dateformat"("dateadd"("mm",1,@data_date),'yyyymm01')),'yyyymmdd'); set @last_month = cast("dateformat"("dateadd"("month",-1,@data_date),'yyyymm') as integer); --上月 set @last_last_month = cast("dateformat"("dateadd"("month",-2,@data_date),'yyyymm') as integer); --上上月 set @last_month_this_day = "dateformat"("dateadd"("mm",-1,convert(date,@data_date)),'yyyymmdd'); --上月当天 set @last_year_this_month = convert(integer,"dateformat"("dateadd"("yy",-1,@last_month_this_day),'yyyymm')); --上年当月 set @this_year_first_month = convert(integer,"dateformat"("dateadd"("yy",0,@data_date),'yyyy01')); --本年首月 set @last_year_last_month = cast("dateformat"(convert(integer,"dateformat"("dateadd"("yy",-1,@data_date),'yyyy1231')),'yyyymm') as integer); --上年尾月 set temporary option "conversion_error" = 'OFF'; set temporary option "Query_Temp_Space_Limit" = 0; --drop table if exists rpt_wjq_jf_value_dhfz_list;commit;
06-07
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

_小海_

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

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

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

打赏作者

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

抵扣说明:

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

余额充值