执行hive中的select查询时出错 [英] error while executing select query in hive

查看:390
本文介绍了执行hive中的select查询时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是hadoop 1.1.2,hbase 0.94.8和hive 0.14。
我试图在hbase中使用配置单元和加载数据在其中创建一个表格,稍后通过插入覆盖。



目前,我能够创建表:

  CREATE TABLE hbase_table_emp(id int,name string,role string)
STORED BY'org.apache。 hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES(hbase.columns.mapping=:key,cf1:name,cf1:role)
TBLPROPERTIES(hbase.table.name= EMP);

并将数据加载到另一个表中,我将其覆盖到hbase表中:

  hive>创建表testemp(id int,名称字符串,角色字符串)以'\ t'结尾的行格式分隔字段; 
hive>将数据本地inpath'/home/user/sample.txt'加载到表testemp中;

但是当我尝试 select * from testemp; 验证数据是否已成功加载出现此错误:

 线程main中的异常java.lang.NoSuchMethodError: org.apache.hadoop.mapred.JobConf.unset(Ljava / lang / String;)V 
at org.apache.hadoop.hive.ql.io.HiveInputFormat.pushFilters(HiveInputFormat.java:432)
at org.apache.hadoop.hive.ql.exec.FetchTask.initialize(FetchTask.java:76)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:443)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:303)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1067)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1129)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:247)
在org。 apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:199)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:410)
at org。 apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:783)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
at org。 apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java :57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at org。 apache.hadoop.util.RunJar.main(RunJar.java:156)

有人可以帮助我!谢谢

解决方案

不幸的是,我相信您必须将Hadoop升级到至少1.2.0。



看来Hive试图访问 org.apache.hadoop.mapred.JobConf的 unset 方法类。在查看 API文档对于Hadoop 1.1.2中的该类,您可以看到该方法不存在。

该方法实现的1.x系列的第一个版本是1.2.0(请参阅 API文档)。请注意,该方法实际上是从 org.apache.hadoop.conf.Configuration 类继承的。


I'm using hadoop 1.1.2 , hbase 0.94.8 and hive 0.14 . I'am trying to create a table in hbase using hive and load data in it later by insert overwrite .

for the moment I was able to create the table:

CREATE TABLE hbase_table_emp(id int, name string, role string) 
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:name,cf1:role")
TBLPROPERTIES ("hbase.table.name" = "emp");

and load data into another table that I will overwrite it into the hbase table :

hive> create table testemp(id int, name string, role string) row format delimited fields terminated by '\t';
hive> load data local inpath '/home/user/sample.txt' into table testemp;

but when I try select * from testemp; to verify that the data was loaded successfully I get this error:

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.mapred.JobConf.unset(Ljava/lang/String;)V
    at org.apache.hadoop.hive.ql.io.HiveInputFormat.pushFilters(HiveInputFormat.java:432)
    at org.apache.hadoop.hive.ql.exec.FetchTask.initialize(FetchTask.java:76)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:443)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:303)
    at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1067)
    at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1129)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994)
    at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:247)
    at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:199)
    at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:410)
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:783)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:156)

could someone help me please ! thank you

解决方案

Unfortunately, I believe you will have to upgrade Hadoop to at least 1.2.0.

It appears that Hive is trying to access the unset method of the org.apache.hadoop.mapred.JobConf class. In looking at the API documentation for that class in Hadoop 1.1.2, you can see that method does not exist.

The first release from the 1.x series in which that method gets implemented is 1.2.0 (see the API documentation for the same class). Note that the method actually gets inherited from the org.apache.hadoop.conf.Configuration class.

这篇关于执行hive中的select查询时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆