hive创建分区表问题

最近在使用hive的时候,metadata我是放在mysql(是5.5的版本)里的。

当时mysql设置的字符集是utf8,

正常创建表的时候,一切正常,当我进行创建分区表后,在使用的时候,就出现以下错误信息:

FAILED: Error in metadata: javax.jdo.JDODataStoreException: Error(s) were found while auto-creating/validating the datastore for classes. The errors are printed in the log, and are attached to this exception.
NestedThrowables:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask


以上错误,主要是在select操作、drop操作时,就会出错。

这里提醒下,创建分区表,需要执行alter table 表名 add  PARTITION(stat_date='2011-06-08', province='ZheJiang')这样的SQL语句。

然后才能导入数据。不然就有如下报错信息:

FAILED: Error in semantic analysis: Line 3:10 Partition not found ''2011-12-30''

转回主题来,解决的方案:

是将mysql的数据库字符集设置成latin1,就行了(网上有很多修改字符集的操作,这里就不详细说了)。
修改数据库的字符集
    mysql>use mydb
    mysql>alter database mydb character set latin1;




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值