Hive Bug集锦

来源:互联网 发布:淘宝流量下降的原因 编辑:程序博客网 时间:2024/05/21 07:08

1.安装hive后无法启动,报错如下

[ERROR] Terminal initialization failed; falling back to unsupported java.lang.IncompatibleClassChangeError: Found class jline.

原因是hadoop目录下存在老版本jline:
/hadoop-2.6.5/share/hadoop/yarn/lib:
-rw-r--r-- 1 wkz wkz 87325 Mar 10 18:10 jline-0.9.94.jar
 
解决方法是:
将hive下的新版本jline的JAR包拷贝到hadoop下:
cp /hive/lib/jline-2.12.jar ./
 
/hadoop-2.6.5/share/hadoop/yarn/lib:
-rw-r--r-- 1 wkz wkz 87325 Mar 10 18:10 jline-0.9.94.jar
-rw-r--r-- 1 wkz wkz 213854 Mar 11 22:22 jline-2.12.jar

然后删除老旧的jline-0.9.94.jar包,或者改名,启动成功。




2.安装hive后,创建表出现这个错误(数据库编码问题)

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:For direct MetaStore DB connections, we don't support retries at the client level.)


解决:进入mysql,来到hive的源数据库hive_13下,然后执行:

alter database hive_13 character set latin1;

修改字符编码。



3.创建表出现如下错误(表字段或表名与hive内部的关键字冲突了(e.g:order,user ……)等,有两种解决方案

FAILED: ParseException line 6:0 Failed to recognize predicate 'order'. Failed rule: 'identifier' in column specification


解决:(1). 在关键字处加反引号 ` 可以解决,同时查询时也要加反引号。e.g:select * from `user` where age>20; 

(2). 需要设置一下变量即可解决:   set hive.support.sql11.reserved.keywords=false;  也可以将hive-site.xml配置文件中的此选项改为false,让它始终生效。 以上配置将忽略关键字冲突。

eg:在conf下的hive-site.xml配置文件中修改配置选项:

<property>
    <name>hive.support.sql11.reserved.keywords</name>
    <value>false</value>
</property>


4.启动hive报错 (mysql中hive的权限不够,或者设置错误)

Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

解决:查看和修改mysql中hive的权限:eg:
grant all on *.* to hive@'%' identified by 'hive';
grant all on *.* to hive@'localhost' identified by 'hive';
grant all on *.* to hive@'master' identified by 'hive';
flush privileges;


5.hive建表错误(location 指定出错,不能指定到具体的hdfs上的文件,只能指定文件夹)
hive> create  table if not exists tmp
    > (time string,uid string,keyword string,rank int,order int,url string)
    > row format delimited
    > fields terminated by '\t'
    > location  '/in/sogou';
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:hdfs://ns1/in/sogou is not a directory or unable to create one)

解决:hdfs上创建/in/sogou文件夹,然后把sogou文件放到/in/sogou下

原创粉丝点击