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;




你可能感兴趣的:(mysql,数据库,table,database,character,Semantic)