简体   繁体   English

HiveQL到HBase

[英]HiveQL to HBase

I am using Hive 0.14 and Hbase 0.98.8 I would like to use HiveQL for accessing a HBase "table". 我正在使用Hive 0.14和Hbase 0.98.8,我想使用HiveQL访问HBase“表”。

I created a table with a complex composite rowkey: 我用复杂的复合行键创建了一个表:

CREATE EXTERNAL TABLE db.hive_hbase (rowkey struct<p1:string, p2:string, p3:string>, column1 string, column2 string) 
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
COLLECTION ITEMS TERMINATED BY ';'
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = 
":key,cf:c1,cf:c2")
TBLPROPERTIES("hbase.table.name"="hbase_table");

The table is getting successfully created, but the HiveQL is taking forever: 该表已成功创建,但是HiveQL永远需要:

SELECT * from db.hive_hbase WHERE rowkey.p1 = 'xyz';

Queries without using the rowkey are fine and also using the hbase shell with filters are working. 不使用rowkey的查询就可以了,并且将hbase shell与过滤器一起使用也可以正常工作。 I don't find anything in the logs, but I assume that there could be an issue with complex composite keys and performance. 我没有在日志中找到任何内容,但是我认为复杂的复合键和性能可能会出现问题。

Did anybody face the same issue? 有人遇到过同样的问题吗? Hints to solve it? 解决的提示? Other ideas, what I could try? 其他想法,我可以尝试什么?

Thank you 谢谢

Update 16.07.15: I changed the log4j properties to 'DEBUG' and found some interesting information: 更新16.07.15:我将log4j属性更改为“ DEBUG”,并发现了一些有趣的信息:

It says: 它说:

2015-07-15 15:56:41,232 INFO  ppd.OpProcFactory    (OpProcFactory.java:logExpr(823)) - Pushdown Predicates of FIL For Alias : hive_hbase
2015-07-15 15:56:41,232 INFO  ppd.OpProcFactory (OpProcFactory.java:logExpr(826)) -     (rowkey.p1 = 'xyz')

But some lines later: 但是稍后几行:

2015-07-15 15:56:41,430 DEBUG ppd.OpProcFactory (OpProcFactory.java:pushFilterToStorageHandler(1051)) - No pushdown possible for predicate:  (rowkey.p1 = 'xyz')

So my guess is: HiveQL over HBase does not do any predicate pushdown in Hbase but rather starts a MapReduce job. 所以我的猜测是:基于HBase的HiveQL不会在Hbase中进行任何谓词下推,而是启动MapReduce作业。

Could there be a bug with the predicate pushdown? 谓词下推可能存在错误吗?

I tried similar situation using Hive 0.13 and it works fine. 我使用Hive 0.13尝试了类似的情况,并且工作正常。 I got the result. 我得到了结果。 What version of hive are you working on? 您正在使用哪个版本的蜂巢?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM