Question: I would like to know how can I map a value of a key. 
I know that it can be done with Get and then Put operations. Is there any other way to do it efficiently? 'checkAndPut' is not ver helpful 
can it be done with something like :

```
(key,value) =>  value+g()

```

I have read the book *HBase the Definitive Guide* and it seems like Map Reduce Job interpreted to Put/Get operations on top of HBase. Does it means that it is not a 'Bulk Operation' (since it's an operation per key) ? 

How /Does Spark relevant here ?

Answer: 
1. HBase has scans ([1](https://hbase.apache.org/book.html#scan)) to retrieve multiple rows; and MapReduce jobs can and do use this command ([2](https://hbase.apache.org/book.html#mapreduce.example)).
2. For HBase 'bulk' is mostly [or solely] is 'bulk load'/'bulk import' where one adds data via constructing HFiles and 'injecting' them to HBase cluster (as opposed to PUT-s) ([3](https://hbase.apache.org/book.html#arch.bulk.load)).
3. Your task can be implemented as a MapReduce Job as well as a Spark app ([4](https://www.mapr.com/developercentral/code/loading-hbase-tables-spark#.V-tPvh8tqis) being one of examples, maybe not the best one), or a Pig script, or a Hive query if you use HBase table from Hive ([5](http://hortonworks.com/blog/hbase-via-hive-part-1/)); pick your poison.
If you set up a Table with a counter then you can use an [Increment](https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Increment.html) to add a certain amount to the existing value in an atomic operation.

From a MapReduce job you would aggregate your input in micro batches (wherever you have your incremental counts), group them by key/value, sum them up, and then issue a [Put](https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Put.html) from your job (1 Put per key).

What I mentioned above is not a 'bulk' operation but it would probably work just fine if the amount of rows that you modify in each batch is relatively small compared to the total number or rows in your table.

IFF you expect to modify your entire table at each batch then you should look at [Bulk Loads](http://hbase.apache.org/book.html#arch.bulk.load). This will require you to write a job that reads your existing values in HBase, your new values from the incremental sources, add them together, and write them back to HBase (In a 'bulk load' fashion, not directly)

A Bulk Load writes HFiles directly to HDFS without going through the HBase 'write pipeline' (Memstore, minor compactions, major compactions, etc), and then issue a command to swap the existing files with the new ones. The swap is FAST! Note, you could also generate the new HFile outside the HBase cluster (not to overload it) and then copy them over and issue the swap command.