You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Tom White (JIRA)" <ji...@apache.org> on 2007/07/03 22:47:04 UTC

[jira] Updated: (HADOOP-1231) Add generics to Mapper and Reducer interfaces

     [ https://issues.apache.org/jira/browse/HADOOP-1231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated HADOOP-1231:
------------------------------

    Attachment: HADOOP-1231.patch

This patch is work in progress, but shows what I'm trying to achieve. I've generified the public MapReduce API, the idea being that user programs can be type checked at compile time. See the changes in WordCount for an example of this.

However, this approach has run into difficulties. When trying to change the Grep example, the line

{{grepJob.setReducerClass(LongSumReducer.class);}}

no longer compiles. This does:

{{grepJob.setReducerClass((new LongSumReducer<Text>() {}).getClass());}}

but it's not very nice. The heart of the problem is that you can't say LongSumReducer<Text>.class in Java, due to erasure. It's discussed by Neal Gafter: http://gafter.blogspot.com/2006/12/super-type-tokens.html, but his solution is still a syntactic mouthful.

Any suggestions would be welcome!

> Add generics to Mapper and Reducer interfaces
> ---------------------------------------------
>
>                 Key: HADOOP-1231
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1231
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: mapred
>            Reporter: Owen O'Malley
>            Assignee: Tom White
>         Attachments: HADOOP-1231.patch
>
>
> By making the input and output types of the Mapper and Reducers generic, we can get the information from the classes and not require the user to set them in the configuration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.