尽管目前框架允许一个 HBase 表作为 MapReduce 作业的输入,但其他 HBase 表只可以通过作为查找表(lookup tables)才能访问,例如在 MapReduce 作业中通过 mapper 的 setup 方法创建 Table 实例.

public class MyMapper extends TableMapper<Text, LongWritable> {
  private Table myOtherTable;

  public void setup(Context context) {
    // In here create a Connection to the cluster and save it or use the Connection
    // from the existing table
    myOtherTable = connection.getTable("myOtherTable");
  }

  public void map(ImmutableBytesWritable row, Result value, Context context) throws IOException, InterruptedException {
    // process Result...
    // use 'myOtherTable' for lookups
  }