Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Understanding mapper/reducer generics

Understanding mapper/reducer generics

New Contributor

I'm trying to understand the use of generics in the mapper/reducer classes from examples I've seen in various books.  For instance, I understand the following:

 

List<String> aStringArrayList : types the instance to an ArrayList of Strings

List<TaxRecord> myTaxRecords: types the instance to an ArrayList of TaxRecords

 

However, I don't understand (in the same way as the above examples) the following:

 

Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>

 

What do KEYIN, VALUEIN, KEYOUT, VALUEOUT represent?  Are they defined anywhere in the Hadoop source code?  I know that they represent input/output values to the mapper (and reducer) but don't understand how they are defined.

 

 

Thanks in advance to all who reply.

Kevin
2 REPLIES 2

Re: Understanding mapper/reducer generics

Rising Star

Hi, I recommend the hadoop definite guide - very good book with good explanation, how and why mapreduce works as it works,

Tomas

http://shop.oreilly.com/product/0636920021773.do

Highlighted

Re: Understanding mapper/reducer generics

Master Guru
The KEYIN, VALUEIN, etc. are expressed in what's called Generic Types in Java. See https://docs.oracle.com/javase/tutorial/java/generics/types.html for a good explanation on what this is and why it makes sense for MR to use it.