Support Questions

Find answers, ask questions, and share your expertise

Use of java generics in hadoop map reduce jobs?

avatar

How often we use java generics in map reduce jobs.Your inputs is highly appreciated!

1 ACCEPTED SOLUTION

avatar
Master Mentor

In 3 years of writing mapreduce code,i only needed to use generics once. That's not to say it's not useful, it's pretty powerful when you are dealing with objects that have various types. In my case it was a mapreduce program running against HBase, I would extract payload and within it, I had to figure out what was the value type.

View solution in original post

3 REPLIES 3

avatar
Master Guru

You mean the normal Java Generics?

https://en.wikipedia.org/wiki/Generics_in_Java

Like ArrayList<String>() Generics?

In that case I am pretty sure almost every MapReduce job out there uses it. MapReduce can run any Java code that can be executed by the JVM currently in HDP its Java8. So if you want to use Lambda functions you could as well. And Generics have been around forever so I would hope any well written library uses them.

avatar
Master Mentor

In 3 years of writing mapreduce code,i only needed to use generics once. That's not to say it's not useful, it's pretty powerful when you are dealing with objects that have various types. In my case it was a mapreduce program running against HBase, I would extract payload and within it, I had to figure out what was the value type.

avatar
Master Guru

Hmmm I suppose it depends how you see the question. Pretty sure everybody uses generics but you are right I haven't implemented a generic class myself in a MapReduce job before. Pretty sure a lot of libraries do it but yourself during coding. Not really. I think the reason for the question might help.