How to Read Multiple Table Simultaneously in HBase Mapreduce

  • Sample code Segment

    //Create ArrayList
    List table = new ArrayList();


    //Store the first input table
    Scan table1 = new Scan();
    table1.setAttribute("scan.attributes.table.name", Bytes.toBytes("tablename1"));
    table.add(table1);


    //Store the second input table
    Scan table2= new Scan();
    table2.setAttribute("scan.attributes.table.name", Bytes.toBytes("tablename2"));
    table.add(table2);


    //Access mutiple input tables
    TableMapReduceUtil.initTableMapperJob(table, mapper.class, mapper.class, job); //input tables
    TableMapReduceUtil.initTableReducerJob( "outputtable", reducer.class, job); //output tables