[vc_row][vc_column][vc_column_text]

How to Import data in HBase using Mapreduce

[/vc_column_text][vc_empty_space]

  • Sample code Segment

    //HBase mapper
    //Input table passed as pair to Mapper
    map(ImmutableBytesWritable rowKey, Result columns, Context context)
    //Write output of mapper as pair
    context.write(key1,value1);

  • Command

    //HBase Reducer
    //Reducer access of key-value pair from mapper output
    reduce(Text key1, Iterable value1, Context context)
    for each(IntWritable s:values1)
    sum+=s
    end for
    // Create HBase output table with rowkey
    Put outputable = new Put(key1);
    // Insert sum value to HBase output table
    outputable.add(columnfamily,column, sum);
    // Write data to HBase ouput table
    context.write(null, outputable);

[/vc_column][/vc_row][vc_row][vc_column][vc_empty_space][vc_row_inner][vc_column_inner width=”1/3″][vc_column_text]

Previous Sample

[/vc_column_text][/vc_column_inner][vc_column_inner width=”1/3″][vc_column_text]

List

[/vc_column_text][/vc_column_inner][vc_column_inner width=”1/3″][vc_column_text]

Next Sample

[/vc_column_text][/vc_column_inner][/vc_row_inner][vc_empty_space][/vc_column][/vc_row]
[vc_row][vc_column][vc_empty_space height=”20px”][vc_column_text]

[/vc_column_text][vc_empty_space height=”20px”][vc_column_text]

[/vc_column_text][vc_empty_space height=”20px”][vc_column_text]

[/vc_column_text][vc_empty_space height=”20px”][/vc_column][/vc_row]