hive创建分区表问题
2011-12-30 16:40
183 查看
最近在使用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设置的字符集是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;
相关文章推荐
- hive创建分区表问题
- Hive:解决Hive创建文件数过多的问题
- Hive:解决Hive创建文件数过多的问题
- Hive创建二级分区表
- 基于CDH5.x 下面使用eclipse 操作hive 。使用java通过jdbc连接HIVESERVICE 创建表出现的问题及解决
- hive 的表操作问题 hive中简单介绍分区表
- sparkSQL读取hive分区表的问题追踪
- Hive分区表修改表结构的问题
- Hive内部表、外部表、分区表以及外部分区表创建以及导入数据实例讲解
- Hive内部表,外部表,分区表的创建
- HIVE 创建外部分区表--利用HUE不能创建外部表
- 对分区表创建本地索引的问题
- Hive创建表时添加中文注释后乱码问题
- Hive学习笔记 --- Hive创建分区表
- Hive文件数创建过多的问题
- Hive创建分区表
- Hive的表的创建及外部表、分区表介绍
- Hive:解决Hive创建文件数过多的问题
- Hive分区表创建、分类
- hive创建分区表