简体   繁体   English

如何在Hbase中加入两个表

[英]How to Join two tables in Hbase

Problem: 问题:

I am new to Hbase and I came across a situation where I need to join two tables. 我是Hbase的新手,我遇到了需要加入两个表的情况。
Let us suppose I have Employee table and Department table both are created in Hbase. 我们假设我在Hbase中创建了Employee表和Department表。 By reading Hbase in action , I got to know that we cannot join tables in Hbase. 通过阅读Hbase,我知道我们无法在Hbase中连接表。

Solution: 解:

I found out a solution that by writing MapReduce Code using Hbase classes and Interfaces we can achieve this task. 我找到了一个解决方案,通过使用Hbase类和接口编写MapReduce代码,我们可以完成这项任务。

Also if someone can help me with the coding that would be very helpful 此外,如果有人可以帮助我编写非常有用的编码

You should look at this jira issue in apache. 你应该在apache中看看这个jira问题。 You should use MultiTableInputFormat. 您应该使用MultiTableInputFormat。 https://issues.apache.org/jira/browse/HBASE-3996 https://issues.apache.org/jira/browse/HBASE-3996

See also: how to join tables in hbase 另请参见: 如何在hbase中连接表

最简单的方法是将HBase表加载到HiveImpala中,并使用这些工具执行SQL连接。

Using Hive or Impala is costly when data is to large and we face issue like Hbase kill(region server Down) . 当数据量很大并且我们面临像Hbase kill(区域服务器Down)这样的问题时,使用Hive或Impala会很昂贵。 so it is convenient when data is small but not for large Data. 所以当数据很小但不适合大数据时很方便。 In mapreduce take Hbase table object to take one table and by extending tablemapper use 2nd table. 在mapreduce中取Hbase表对象取一个表并通过扩展tablemapper使用第二个表。 By this way you can join 2 tables. 通过这种方式,您可以加入2个表。

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

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