source: proiecte/HadoopJUnit/hadoop-0.20.1/docs/api/org/apache/hadoop/mapreduce/Reducer.html @ 120

Last change on this file since 120 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 24.6 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.6.0_07) on Tue Sep 01 20:56:58 UTC 2009 -->
6<TITLE>
7Reducer (Hadoop 0.20.1 API)
8</TITLE>
9
10<META NAME="date" CONTENT="2009-09-01">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
13
14<SCRIPT type="text/javascript">
15function windowTitle()
16{
17    if (location.href.indexOf('is-external=true') == -1) {
18        parent.document.title="Reducer (Hadoop 0.20.1 API)";
19    }
20}
21</SCRIPT>
22<NOSCRIPT>
23</NOSCRIPT>
24
25</HEAD>
26
27<BODY BGCOLOR="white" onload="windowTitle();">
28<HR>
29
30
31<!-- ========= START OF TOP NAVBAR ======= -->
32<A NAME="navbar_top"><!-- --></A>
33<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
34<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
35<TR>
36<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
37<A NAME="navbar_top_firstrow"><!-- --></A>
38<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
39  <TR ALIGN="center" VALIGN="top">
40  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Reducer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
48  </TR>
49</TABLE>
50</TD>
51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
52</EM>
53</TD>
54</TR>
55
56<TR>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58&nbsp;<A HREF="../../../../org/apache/hadoop/mapreduce/ReduceContext.ValueIterator.html" title="class in org.apache.hadoop.mapreduce"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce"><B>NEXT CLASS</B></A></FONT></TD>
60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61  <A HREF="../../../../index.html?org/apache/hadoop/mapreduce/Reducer.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="Reducer.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
63&nbsp;<SCRIPT type="text/javascript">
64  <!--
65  if(window==top) {
66    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
67  }
68  //-->
69</SCRIPT>
70<NOSCRIPT>
71  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
72</NOSCRIPT>
73
74
75</FONT></TD>
76</TR>
77<TR>
78<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
79  SUMMARY:&nbsp;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
81DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
82</TR>
83</TABLE>
84<A NAME="skip-navbar_top"></A>
85<!-- ========= END OF TOP NAVBAR ========= -->
86
87<HR>
88<!-- ======== START OF CLASS DATA ======== -->
89<H2>
90<FONT SIZE="-1">
91org.apache.hadoop.mapreduce</FONT>
92<BR>
93Class Reducer&lt;KEYIN,VALUEIN,KEYOUT,VALUEOUT&gt;</H2>
94<PRE>
95<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
96  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.hadoop.mapreduce.Reducer&lt;KEYIN,VALUEIN,KEYOUT,VALUEOUT&gt;</B>
97</PRE>
98<DL>
99<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/apache/hadoop/mapreduce/lib/reduce/IntSumReducer.html" title="class in org.apache.hadoop.mapreduce.lib.reduce">IntSumReducer</A>, <A HREF="../../../../org/apache/hadoop/mapreduce/lib/reduce/LongSumReducer.html" title="class in org.apache.hadoop.mapreduce.lib.reduce">LongSumReducer</A>, <A HREF="../../../../org/apache/hadoop/examples/SecondarySort.Reduce.html" title="class in org.apache.hadoop.examples">SecondarySort.Reduce</A>, <A HREF="../../../../org/apache/hadoop/examples/WordCount.IntSumReducer.html" title="class in org.apache.hadoop.examples">WordCount.IntSumReducer</A></DD>
100</DL>
101<HR>
102<DL>
103<DT><PRE>public class <B>Reducer&lt;KEYIN,VALUEIN,KEYOUT,VALUEOUT&gt;</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
104</PRE>
105
106<P>
107Reduces a set of intermediate values which share a key to a smaller set of
108 values. 
109 
110 <p><code>Reducer</code> implementations
111 can access the <A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf"><CODE>Configuration</CODE></A> for the job via the
112 <A HREF="../../../../org/apache/hadoop/mapreduce/JobContext.html#getConfiguration()"><CODE>JobContext.getConfiguration()</CODE></A> method.</p>
113
114 <p><code>Reducer</code> has 3 primary phases:</p>
115 <ol>
116   <li>
117   
118   <h4 id="Shuffle">Shuffle</h4>
119   
120   <p>The <code>Reducer</code> copies the sorted output from each
121   <A HREF="../../../../org/apache/hadoop/mapreduce/Mapper.html" title="class in org.apache.hadoop.mapreduce"><CODE>Mapper</CODE></A> using HTTP across the network.</p>
122   </li>
123   
124   <li>
125   <h4 id="Sort">Sort</h4>
126   
127   <p>The framework merge sorts <code>Reducer</code> inputs by
128   <code>key</code>s
129   (since different <code>Mapper</code>s may have output the same key).</p>
130   
131   <p>The shuffle and sort phases occur simultaneously i.e. while outputs are
132   being fetched they are merged.</p>
133     
134   <h5 id="SecondarySort">SecondarySort</h5>
135   
136   <p>To achieve a secondary sort on the values returned by the value
137   iterator, the application should extend the key with the secondary
138   key and define a grouping comparator. The keys will be sorted using the
139   entire key, but will be grouped using the grouping comparator to decide
140   which keys and values are sent in the same call to reduce.The grouping
141   comparator is specified via
142   <A HREF="../../../../org/apache/hadoop/mapreduce/Job.html#setGroupingComparatorClass(java.lang.Class)"><CODE>Job.setGroupingComparatorClass(Class)</CODE></A>. The sort order is
143   controlled by
144   <A HREF="../../../../org/apache/hadoop/mapreduce/Job.html#setSortComparatorClass(java.lang.Class)"><CODE>Job.setSortComparatorClass(Class)</CODE></A>.</p>
145   
146   
147   For example, say that you want to find duplicate web pages and tag them
148   all with the url of the "best" known example. You would set up the job
149   like:
150   <ul>
151     <li>Map Input Key: url</li>
152     <li>Map Input Value: document</li>
153     <li>Map Output Key: document checksum, url pagerank</li>
154     <li>Map Output Value: url</li>
155     <li>Partitioner: by checksum</li>
156     <li>OutputKeyComparator: by checksum and then decreasing pagerank</li>
157     <li>OutputValueGroupingComparator: by checksum</li>
158   </ul>
159   </li>
160   
161   <li>   
162   <h4 id="Reduce">Reduce</h4>
163   
164   <p>In this phase the
165   <A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html#reduce(KEYIN, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)"><CODE>reduce(Object, Iterable, Context)</CODE></A>
166   method is called for each <code>&lt;key, (collection of values)></code> in
167   the sorted inputs.</p>
168   <p>The output of the reduce task is typically written to a
169   <A HREF="../../../../org/apache/hadoop/mapreduce/RecordWriter.html" title="class in org.apache.hadoop.mapreduce"><CODE>RecordWriter</CODE></A> via
170   <A HREF="../../../../org/apache/hadoop/mapreduce/TaskInputOutputContext.html#write(KEYOUT, VALUEOUT)"><CODE>TaskInputOutputContext.write(Object, Object)</CODE></A>.</p>
171   </li>
172 </ol>
173 
174 <p>The output of the <code>Reducer</code> is <b>not re-sorted</b>.</p>
175 
176 <p>Example:</p>
177 <p><blockquote><pre>
178 public class IntSumReducer<Key> extends Reducer<Key,IntWritable,
179                                                 Key,IntWritable> {
180   private IntWritable result = new IntWritable();
181 
182   public void reduce(Key key, Iterable<IntWritable> values,
183                      Context context) throws IOException {
184     int sum = 0;
185     for (IntWritable val : values) {
186       sum += val.get();
187     }
188     result.set(sum);
189     context.collect(key, result);
190   }
191 }
192 </pre></blockquote></p>
193<P>
194
195<P>
196<DL>
197<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/hadoop/mapreduce/Mapper.html" title="class in org.apache.hadoop.mapreduce"><CODE>Mapper</CODE></A>,
198<A HREF="../../../../org/apache/hadoop/mapreduce/Partitioner.html" title="class in org.apache.hadoop.mapreduce"><CODE>Partitioner</CODE></A></DL>
199<HR>
200
201<P>
202<!-- ======== NESTED CLASS SUMMARY ======== -->
203
204<A NAME="nested_class_summary"><!-- --></A>
205<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
206<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
207<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
208<B>Nested Class Summary</B></FONT></TH>
209</TR>
210<TR BGCOLOR="white" CLASS="TableRowColor">
211<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
212<CODE>&nbsp;class</CODE></FONT></TD>
213<TD><CODE><B><A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A></B></CODE>
214
215<BR>
216&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
217</TR>
218</TABLE>
219&nbsp;
220<!-- ======== CONSTRUCTOR SUMMARY ======== -->
221
222<A NAME="constructor_summary"><!-- --></A>
223<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
224<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
225<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
226<B>Constructor Summary</B></FONT></TH>
227</TR>
228<TR BGCOLOR="white" CLASS="TableRowColor">
229<TD><CODE><B><A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html#Reducer()">Reducer</A></B>()</CODE>
230
231<BR>
232&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
233</TR>
234</TABLE>
235&nbsp;
236<!-- ========== METHOD SUMMARY =========== -->
237
238<A NAME="method_summary"><!-- --></A>
239<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
240<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
241<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
242<B>Method Summary</B></FONT></TH>
243</TR>
244<TR BGCOLOR="white" CLASS="TableRowColor">
245<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
246<CODE>protected &nbsp;void</CODE></FONT></TD>
247<TD><CODE><B><A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html#cleanup(org.apache.hadoop.mapreduce.Reducer.Context)">cleanup</A></B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A>&nbsp;context)</CODE>
248
249<BR>
250&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Called once at the end of the task.</TD>
251</TR>
252<TR BGCOLOR="white" CLASS="TableRowColor">
253<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
254<CODE>protected &nbsp;void</CODE></FONT></TD>
255<TD><CODE><B><A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html#reduce(KEYIN, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)">reduce</A></B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html" title="type parameter in Reducer">KEYIN</A>&nbsp;key,
256       <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html" title="type parameter in Reducer">VALUEIN</A>&gt;&nbsp;values,
257       <A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A>&nbsp;context)</CODE>
258
259<BR>
260&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method is called once for each key.</TD>
261</TR>
262<TR BGCOLOR="white" CLASS="TableRowColor">
263<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
264<CODE>&nbsp;void</CODE></FONT></TD>
265<TD><CODE><B><A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html#run(org.apache.hadoop.mapreduce.Reducer.Context)">run</A></B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A>&nbsp;context)</CODE>
266
267<BR>
268&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Advanced application writers can use the
269 <A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html#run(org.apache.hadoop.mapreduce.Reducer.Context)"><CODE>run(org.apache.hadoop.mapreduce.Reducer.Context)</CODE></A> method to
270 control how the reduce task works.</TD>
271</TR>
272<TR BGCOLOR="white" CLASS="TableRowColor">
273<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
274<CODE>protected &nbsp;void</CODE></FONT></TD>
275<TD><CODE><B><A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html#setup(org.apache.hadoop.mapreduce.Reducer.Context)">setup</A></B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A>&nbsp;context)</CODE>
276
277<BR>
278&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Called once at the start of the task.</TD>
279</TR>
280</TABLE>
281&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
282<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
283<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
284<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
285</TR>
286<TR BGCOLOR="white" CLASS="TableRowColor">
287<TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
288</TR>
289</TABLE>
290&nbsp;
291<P>
292
293<!-- ========= CONSTRUCTOR DETAIL ======== -->
294
295<A NAME="constructor_detail"><!-- --></A>
296<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
297<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
298<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
299<B>Constructor Detail</B></FONT></TH>
300</TR>
301</TABLE>
302
303<A NAME="Reducer()"><!-- --></A><H3>
304Reducer</H3>
305<PRE>
306public <B>Reducer</B>()</PRE>
307<DL>
308</DL>
309
310<!-- ============ METHOD DETAIL ========== -->
311
312<A NAME="method_detail"><!-- --></A>
313<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
314<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
315<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
316<B>Method Detail</B></FONT></TH>
317</TR>
318</TABLE>
319
320<A NAME="setup(org.apache.hadoop.mapreduce.Reducer.Context)"><!-- --></A><H3>
321setup</H3>
322<PRE>
323protected void <B>setup</B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A>&nbsp;context)
324              throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A>,
325                     <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></PRE>
326<DL>
327<DD>Called once at the start of the task.
328<P>
329<DD><DL>
330
331<DT><B>Throws:</B>
332<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE>
333<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></CODE></DL>
334</DD>
335</DL>
336<HR>
337
338<A NAME="reduce(java.lang.Object,java.lang.Iterable,org.apache.hadoop.mapreduce.Reducer.Context)"><!-- --></A><A NAME="reduce(KEYIN, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)"><!-- --></A><H3>
339reduce</H3>
340<PRE>
341protected void <B>reduce</B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html" title="type parameter in Reducer">KEYIN</A>&nbsp;key,
342                      <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html" title="type parameter in Reducer">VALUEIN</A>&gt;&nbsp;values,
343                      <A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A>&nbsp;context)
344               throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A>,
345                      <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></PRE>
346<DL>
347<DD>This method is called once for each key. Most applications will define
348 their reduce class by overriding this method. The default implementation
349 is an identity function.
350<P>
351<DD><DL>
352
353<DT><B>Throws:</B>
354<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE>
355<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></CODE></DL>
356</DD>
357</DL>
358<HR>
359
360<A NAME="cleanup(org.apache.hadoop.mapreduce.Reducer.Context)"><!-- --></A><H3>
361cleanup</H3>
362<PRE>
363protected void <B>cleanup</B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A>&nbsp;context)
364                throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A>,
365                       <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></PRE>
366<DL>
367<DD>Called once at the end of the task.
368<P>
369<DD><DL>
370
371<DT><B>Throws:</B>
372<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE>
373<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></CODE></DL>
374</DD>
375</DL>
376<HR>
377
378<A NAME="run(org.apache.hadoop.mapreduce.Reducer.Context)"><!-- --></A><H3>
379run</H3>
380<PRE>
381public void <B>run</B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A>&nbsp;context)
382         throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A>,
383                <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></PRE>
384<DL>
385<DD>Advanced application writers can use the
386 <A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html#run(org.apache.hadoop.mapreduce.Reducer.Context)"><CODE>run(org.apache.hadoop.mapreduce.Reducer.Context)</CODE></A> method to
387 control how the reduce task works.
388<P>
389<DD><DL>
390
391<DT><B>Throws:</B>
392<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE>
393<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></CODE></DL>
394</DD>
395</DL>
396<!-- ========= END OF CLASS DATA ========= -->
397<HR>
398
399
400<!-- ======= START OF BOTTOM NAVBAR ====== -->
401<A NAME="navbar_bottom"><!-- --></A>
402<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
403<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
404<TR>
405<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
406<A NAME="navbar_bottom_firstrow"><!-- --></A>
407<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
408  <TR ALIGN="center" VALIGN="top">
409  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
410  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
411  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
412  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Reducer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
413  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
414  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
415  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
416  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
417  </TR>
418</TABLE>
419</TD>
420<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
421</EM>
422</TD>
423</TR>
424
425<TR>
426<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
427&nbsp;<A HREF="../../../../org/apache/hadoop/mapreduce/ReduceContext.ValueIterator.html" title="class in org.apache.hadoop.mapreduce"><B>PREV CLASS</B></A>&nbsp;
428&nbsp;<A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce"><B>NEXT CLASS</B></A></FONT></TD>
429<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
430  <A HREF="../../../../index.html?org/apache/hadoop/mapreduce/Reducer.html" target="_top"><B>FRAMES</B></A>  &nbsp;
431&nbsp;<A HREF="Reducer.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
432&nbsp;<SCRIPT type="text/javascript">
433  <!--
434  if(window==top) {
435    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
436  }
437  //-->
438</SCRIPT>
439<NOSCRIPT>
440  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
441</NOSCRIPT>
442
443
444</FONT></TD>
445</TR>
446<TR>
447<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
448  SUMMARY:&nbsp;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
449<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
450DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
451</TR>
452</TABLE>
453<A NAME="skip-navbar_bottom"></A>
454<!-- ======== END OF BOTTOM NAVBAR ======= -->
455
456<HR>
457Copyright &copy; 2009 The Apache Software Foundation
458</BODY>
459</HTML>
Note: See TracBrowser for help on using the repository browser.