Question-16: Which are the methods in the Mapper interface?

Answer: The Mapper contains the run() method, which call its own setup() method only once, it also call a map () method for each input and finally calls it cleanup() method. All above methods you can override in your code.

Question-17:  What happens if you don’t override the Mapper methods and keep them as it is?

Answer: If you do not override any methods and leaving even map as-is, it will act as the identity function, and emitting each input record as a separate output.

Question-18: What is the use of Context object?

Answer: The Context object allows the mapper to interact with the rest of the Hadoop system. It Includes configuration data for the job, as well as interfaces which allow it to emit output.

Question-19: How can you add the arbitrary key-value pairs in your mapper?

Answer: You can set arbitrary (key, value) pairs of configuration data in your Job,

For example, with

 Job.getConfiguration().set("myKey", "myVal")

and then retrieve this data in your mapper with 

Context.getConfiguration().get("myKey").

This kind of functionality is typically done in the Mapper's setup() method.

Question-20: How does Mapper’s run() method works?

Answer: The Mapper.run() method calls map(KeyInType, ValInType, Context) for each key-value pair in the InputSplit for that task