hive创建分区表问题
2012-09-17 17:36
316 查看
今天在应用别人提供的新安装的hadoop集群环境时,创建Hive表成功却不能添加数据,不添加任何数据也不能查询。在网上找到这个帖子:
/article/7742763.html 正好解决了我的问题,在此分享。
最近在使用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;
/article/7742763.html 正好解决了我的问题,在此分享。
最近在使用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;
相关文章推荐
- hive创建分区表问题
- hive——创建表不支持新增字段问题
- hive创建外部表需要注意的一个问题
- Hive学习笔记1:Hive创建外部表指向Hbase表时的汉字乱码问题
- Hive---外部分区表的创建
- Hive创建外部分区表
- Hive学习笔记 --- Hive中创建分区表,并且查询数据
- 一起学Hive——创建内部表、外部表、分区表和分桶表及导入数据
- hive 外部分区表的创建与应用
- hive创建表时COMMENT带中文报错问题处理
- Hive:解决Hive创建文件数过多的问题
- hive 创建表时遇到问题 Failed to recognize predicate 'xxx'. Failed rule: 'identifier' in column specificat
- Hive创建二级分区表
- 基于CDH5.x 下面使用eclipse 操作hive 。使用java通过jdbc连接HIVESERVICE 创建表出现的问题及解决
- hive 的表操作问题 hive中简单介绍分区表
- Hive:解决Hive创建文件数过多的问题
- HIVE 创建外部分区表--利用HUE不能创建外部表
- sparkSQL读取hive分区表的问题追踪
- Hive分区表修改表结构的问题
- 对分区表创建本地索引的问题