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 2008/03/01 00:05:51 UTC

[jira] Commented: (HADOOP-1230) Replace parameters with context objects in Mapper, Reducer, Partitioner, InputFormat, and OutputFormat classes

    [ https://issues.apache.org/jira/browse/HADOOP-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574002#action_12574002 ] 

Tom White commented on HADOOP-1230:
-----------------------------------

+1 

Here are a few comments:

# Closeable is passed a context - is this needed? Also, is it true that not all methods will work there - e.g. collect?
# We've lost the Iterator interface in Reducers - it would be nice to keep this, if possible, as it's a standard Java idiom and people expect to be able to iterate using "foreach".
# If we're creating a new JobConf then it might be a good opportunity to reconsider its interface if there are things we want to change (not sure if this is true).
# The formal type parameters have lowercase letters, leading to possible confusion with types. From the Java Generics Tutorial:

{quote}
 We recommend that you use pithy (single character 
 if possible) yet evocative names for formal type parameters. It's best to avoid lower 
 case characters in those names, making it easy to distinguish formal type parameters 
 from ordinary classes and interfaces.
 {quote}

  I prefer K1, V1, K2, V2, K3, V3 when emphasizing the relation between all types in a MapReduce job, or K, V when this distinction is not important. Other possibilities would be KI, VI, KO, VO, or KIN, VIN, KOUT, VOUT.

> Replace parameters with context objects in Mapper, Reducer, Partitioner, InputFormat, and OutputFormat classes
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-1230
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1230
>             Project: Hadoop Core
>          Issue Type: Improvement
>          Components: mapred
>            Reporter: Owen O'Malley
>            Assignee: Owen O'Malley
>         Attachments: context-objs.patch
>
>
> This is a big change, but it will future-proof our API's. To maintain backwards compatibility, I'd suggest that we move over to a new package name (org.apache.hadoop.mapreduce) and deprecate the old interfaces and package. Basically, it will replace:
> package org.apache.hadoop.mapred;
> public interface Mapper extends JobConfigurable, Closeable {
>   void map(WritableComparable key, Writable value, OutputCollector output, Reporter reporter) throws IOException;
> }
> with:
> package org.apache.hadoop.mapreduce;
> public interface Mapper extends Closable {
>   void map(MapContext context) throws IOException;
> }
> where MapContext has the methods like getKey(), getValue(), collect(Key, Value), progress(), etc.

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