concept map in category hbase

appears as: map
Hbase in Action

This is an excerpt from Manning's book Hbase in Action.

This code implements the map task. This function expects long keys and Text instances as input and writes out pairs of Text to LongWritable. Text and LongWritable are Hadoop-speak for String and Long, respectively.

One common use of HBase is to support a large map-side join. In this scenario, you’re reading from HBase as an indexed resource accessible from all map tasks. What is a map-side join, you ask? How does HBase support it? Excellent questions!

Given the sample data, the pseudo-code of the map task for consuming the TimeSpent data looks like this:

This map task splits the k1 input line into the UserID and TimeSpent values. It then constructs a dictionary with type and TimeSpent attributes. As [k2,v2] output, it produces [UserID:dictionary].

A map task for consuming the Users data is similar. The only difference is that it drops a couple of unrelated fields:

Both map tasks use UserID as the value for k2. This allows Hadoop to group all records for the same user. The reduce task has everything it needs to complete the join: