Hive-HBase集成:未找到表

时间:2013-04-19 09:34:57

标签: hbase hive hiveql

我指的是this的Hive-HBase集成。

首先,我确认HBase中没有名为ORDERS_HIVE_DUMMY的表:

hbase(main):016:0> describe 'ORDERS_HIVE_DUMMY'

ERROR: Failed to find table named ORDERS_HIVE_DUMMY

Here is some help for this command:
Describe the named table. For example:
  hbase> describe 't1'

然后我启动了蜂巢壳:

hduser@cldx-1139-1033:~/hadoop_ecosystem/apache_hive/hive_installation/hive-0.9.0/bin$ ./hive --auxpath $HIVE_HOME/lib/hive-hbase-handler-0.9.0.jar,$HBASE_HOME/hbase-0.94.6.1.jar,$HBASE_HOME/lib/zookeeper-3.4.5.jar,$HIVE_HOME/lib/guava-r09.jar -hiveconf hbase.zookeeper.quorum=cldx-1140-1034
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in jar:file:/home/hduser/hadoop_ecosystem/apache_hive/hive_installation/hive-0.9.0/lib/hive-common-0.9.0.jar!/hive-log4j.properties
Hive history file=/tmp/hduser/hive_job_log_hduser_201304192016_1559705029.txt
hive>

然后,我创建了一个表

hive> CREATE TABLE ORDERS_HIVE_DUMMY(ORDER_ID STRING,CUSTOMER_ID STRING,PRODUCT_ID STRING,ORDER_DATE TIMESTAMP,QUANTITY DOUBLE,AMOUNT DOUBLE,PAYMENT_MODE STRING) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'  WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,ORDER_DETAILS:CUSTOMER_ID,ORDER_DETAILS:PRODUCT_ID,ORDER_DETAILS:REQUEST_DATE,ORDER_DETAILS:PRODUCT_QUANTITY,ORDER_DETAILS:PRICE,ORDER_DETAILS:PAYMENT_MODE");
OK
Time taken: 11.893 seconds

然后,我确认该表是在HBase中创建的

hbase(main):017:0> describe 'ORDERS_HIVE_DUMMY'
DESCRIPTION                                                                       ENABLED
 {NAME => 'ORDERS_HIVE_DUMMY', FAMILIES => [{NAME => 'ORDER_DETAILS', BLOOMFILTER true
  => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MI
 N_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'fals
 e', BLOCKCACHE => 'true'}]}

但是现在当我在Hive上查询表时,我得到一个例外:

hive> select * from ORDERS_HIVE_DUMMY;
OK
Failed with exception java.io.IOException:org.apache.hadoop.hbase.TableNotFoundException: orders_hive_dummy
Time taken: 0.455 seconds

我猜查询外部表需要对HIve提示符下写的查询提示吗?可能是什么错误?

1 个答案:

答案 0 :(得分:1)

HBase中的表名为ORDERS_HIVE_DUMMY,但在hive中为orders_hive_dummy,因此您应使用CREATE TABLE orders_hive_dummy