[120] | 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:57 UTC 2009 --> |
---|
| 6 | <TITLE> |
---|
| 7 | ChainReducer (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"> |
---|
| 15 | function windowTitle() |
---|
| 16 | { |
---|
| 17 | if (location.href.indexOf('is-external=true') == -1) { |
---|
| 18 | parent.document.title="ChainReducer (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> </TD> |
---|
| 41 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
---|
| 42 | <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
---|
| 43 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ChainReducer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
---|
| 44 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
---|
| 45 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
---|
| 46 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
---|
| 47 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </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 | <A HREF="../../../../../org/apache/hadoop/mapred/lib/ChainMapper.html" title="class in org.apache.hadoop.mapred.lib"><B>PREV CLASS</B></A> |
---|
| 59 | <A HREF="../../../../../org/apache/hadoop/mapred/lib/CombineFileInputFormat.html" title="class in org.apache.hadoop.mapred.lib"><B>NEXT CLASS</B></A></FONT></TD> |
---|
| 60 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
| 61 | <A HREF="../../../../../index.html?org/apache/hadoop/mapred/lib/ChainReducer.html" target="_top"><B>FRAMES</B></A> |
---|
| 62 | <A HREF="ChainReducer.html" target="_top"><B>NO FRAMES</B></A> |
---|
| 63 | <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: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
---|
| 80 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
| 81 | DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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"> |
---|
| 91 | org.apache.hadoop.mapred.lib</FONT> |
---|
| 92 | <BR> |
---|
| 93 | Class ChainReducer</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.mapred.lib.ChainReducer</B> |
---|
| 97 | </PRE> |
---|
| 98 | <DL> |
---|
| 99 | <DT><B>All Implemented Interfaces:</B> <DD><A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</A>, <A HREF="../../../../../org/apache/hadoop/mapred/JobConfigurable.html" title="interface in org.apache.hadoop.mapred">JobConfigurable</A>, <A HREF="../../../../../org/apache/hadoop/mapred/Reducer.html" title="interface in org.apache.hadoop.mapred">Reducer</A></DD> |
---|
| 100 | </DL> |
---|
| 101 | <HR> |
---|
| 102 | <DL> |
---|
| 103 | <DT><PRE>public class <B>ChainReducer</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><DT>implements <A HREF="../../../../../org/apache/hadoop/mapred/Reducer.html" title="interface in org.apache.hadoop.mapred">Reducer</A></DL> |
---|
| 104 | </PRE> |
---|
| 105 | |
---|
| 106 | <P> |
---|
| 107 | The ChainReducer class allows to chain multiple Mapper classes after a |
---|
| 108 | Reducer within the Reducer task. |
---|
| 109 | <p/> |
---|
| 110 | For each record output by the Reducer, the Mapper classes are invoked in a |
---|
| 111 | chained (or piped) fashion, the output of the first becomes the input of the |
---|
| 112 | second, and so on until the last Mapper, the output of the last Mapper will |
---|
| 113 | be written to the task's output. |
---|
| 114 | <p/> |
---|
| 115 | The key functionality of this feature is that the Mappers in the chain do not |
---|
| 116 | need to be aware that they are executed after the Reducer or in a chain. |
---|
| 117 | This enables having reusable specialized Mappers that can be combined to |
---|
| 118 | perform composite operations within a single task. |
---|
| 119 | <p/> |
---|
| 120 | Special care has to be taken when creating chains that the key/values output |
---|
| 121 | by a Mapper are valid for the following Mapper in the chain. It is assumed |
---|
| 122 | all Mappers and the Reduce in the chain use maching output and input key and |
---|
| 123 | value classes as no conversion is done by the chaining code. |
---|
| 124 | <p/> |
---|
| 125 | Using the ChainMapper and the ChainReducer classes is possible to compose |
---|
| 126 | Map/Reduce jobs that look like <code>[MAP+ / REDUCE MAP*]</code>. And |
---|
| 127 | immediate benefit of this pattern is a dramatic reduction in disk IO. |
---|
| 128 | <p/> |
---|
| 129 | IMPORTANT: There is no need to specify the output key/value classes for the |
---|
| 130 | ChainReducer, this is done by the setReducer or the addMapper for the last |
---|
| 131 | element in the chain. |
---|
| 132 | <p/> |
---|
| 133 | ChainReducer usage pattern: |
---|
| 134 | <p/> |
---|
| 135 | <pre> |
---|
| 136 | ... |
---|
| 137 | conf.setJobName("chain"); |
---|
| 138 | conf.setInputFormat(TextInputFormat.class); |
---|
| 139 | conf.setOutputFormat(TextOutputFormat.class); |
---|
| 140 | <p/> |
---|
| 141 | JobConf mapAConf = new JobConf(false); |
---|
| 142 | ... |
---|
| 143 | ChainMapper.addMapper(conf, AMap.class, LongWritable.class, Text.class, |
---|
| 144 | Text.class, Text.class, true, mapAConf); |
---|
| 145 | <p/> |
---|
| 146 | JobConf mapBConf = new JobConf(false); |
---|
| 147 | ... |
---|
| 148 | ChainMapper.addMapper(conf, BMap.class, Text.class, Text.class, |
---|
| 149 | LongWritable.class, Text.class, false, mapBConf); |
---|
| 150 | <p/> |
---|
| 151 | JobConf reduceConf = new JobConf(false); |
---|
| 152 | ... |
---|
| 153 | ChainReducer.setReducer(conf, XReduce.class, LongWritable.class, Text.class, |
---|
| 154 | Text.class, Text.class, true, reduceConf); |
---|
| 155 | <p/> |
---|
| 156 | ChainReducer.addMapper(conf, CMap.class, Text.class, Text.class, |
---|
| 157 | LongWritable.class, Text.class, false, null); |
---|
| 158 | <p/> |
---|
| 159 | ChainReducer.addMapper(conf, DMap.class, LongWritable.class, Text.class, |
---|
| 160 | LongWritable.class, LongWritable.class, true, null); |
---|
| 161 | <p/> |
---|
| 162 | FileInputFormat.setInputPaths(conf, inDir); |
---|
| 163 | FileOutputFormat.setOutputPath(conf, outDir); |
---|
| 164 | ... |
---|
| 165 | <p/> |
---|
| 166 | JobClient jc = new JobClient(conf); |
---|
| 167 | RunningJob job = jc.submitJob(conf); |
---|
| 168 | ... |
---|
| 169 | </pre> |
---|
| 170 | <P> |
---|
| 171 | |
---|
| 172 | <P> |
---|
| 173 | <HR> |
---|
| 174 | |
---|
| 175 | <P> |
---|
| 176 | |
---|
| 177 | <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
---|
| 178 | |
---|
| 179 | <A NAME="constructor_summary"><!-- --></A> |
---|
| 180 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 181 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
| 182 | <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
---|
| 183 | <B>Constructor Summary</B></FONT></TH> |
---|
| 184 | </TR> |
---|
| 185 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 186 | <TD><CODE><B><A HREF="../../../../../org/apache/hadoop/mapred/lib/ChainReducer.html#ChainReducer()">ChainReducer</A></B>()</CODE> |
---|
| 187 | |
---|
| 188 | <BR> |
---|
| 189 | Constructor.</TD> |
---|
| 190 | </TR> |
---|
| 191 | </TABLE> |
---|
| 192 | |
---|
| 193 | <!-- ========== METHOD SUMMARY =========== --> |
---|
| 194 | |
---|
| 195 | <A NAME="method_summary"><!-- --></A> |
---|
| 196 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 197 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
| 198 | <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
---|
| 199 | <B>Method Summary</B></FONT></TH> |
---|
| 200 | </TR> |
---|
| 201 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 202 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 203 | <CODE>static |
---|
| 204 | <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
---|
| 205 | <TR ALIGN="right" VALIGN=""> |
---|
| 206 | <TD NOWRAP><FONT SIZE="-1"> |
---|
| 207 | <CODE><K1,V1,K2,V2> |
---|
| 208 | <BR> |
---|
| 209 | void</CODE></FONT></TD> |
---|
| 210 | </TR> |
---|
| 211 | </TABLE> |
---|
| 212 | </CODE></FONT></TD> |
---|
| 213 | <TD><CODE><B><A HREF="../../../../../org/apache/hadoop/mapred/lib/ChainReducer.html#addMapper(org.apache.hadoop.mapred.JobConf, java.lang.Class, java.lang.Class, java.lang.Class, java.lang.Class, java.lang.Class, boolean, org.apache.hadoop.mapred.JobConf)">addMapper</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> job, |
---|
| 214 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/mapred/Mapper.html" title="interface in org.apache.hadoop.mapred">Mapper</A><K1,V1,K2,V2>> klass, |
---|
| 215 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends K1> inputKeyClass, |
---|
| 216 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends V1> inputValueClass, |
---|
| 217 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends K2> outputKeyClass, |
---|
| 218 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends V2> outputValueClass, |
---|
| 219 | boolean byValue, |
---|
| 220 | <A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> mapperConf)</CODE> |
---|
| 221 | |
---|
| 222 | <BR> |
---|
| 223 | Adds a Mapper class to the chain job's JobConf.</TD> |
---|
| 224 | </TR> |
---|
| 225 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 226 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 227 | <CODE> void</CODE></FONT></TD> |
---|
| 228 | <TD><CODE><B><A HREF="../../../../../org/apache/hadoop/mapred/lib/ChainReducer.html#close()">close</A></B>()</CODE> |
---|
| 229 | |
---|
| 230 | <BR> |
---|
| 231 | Closes the ChainReducer, the Reducer and all the Mappers in the chain.</TD> |
---|
| 232 | </TR> |
---|
| 233 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 234 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 235 | <CODE> void</CODE></FONT></TD> |
---|
| 236 | <TD><CODE><B><A HREF="../../../../../org/apache/hadoop/mapred/lib/ChainReducer.html#configure(org.apache.hadoop.mapred.JobConf)">configure</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> job)</CODE> |
---|
| 237 | |
---|
| 238 | <BR> |
---|
| 239 | Configures the ChainReducer, the Reducer and all the Mappers in the chain.</TD> |
---|
| 240 | </TR> |
---|
| 241 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 242 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 243 | <CODE> void</CODE></FONT></TD> |
---|
| 244 | <TD><CODE><B><A HREF="../../../../../org/apache/hadoop/mapred/lib/ChainReducer.html#reduce(java.lang.Object, java.util.Iterator, org.apache.hadoop.mapred.OutputCollector, org.apache.hadoop.mapred.Reporter)">reduce</A></B>(<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> key, |
---|
| 245 | <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A> values, |
---|
| 246 | <A HREF="../../../../../org/apache/hadoop/mapred/OutputCollector.html" title="interface in org.apache.hadoop.mapred">OutputCollector</A> output, |
---|
| 247 | <A HREF="../../../../../org/apache/hadoop/mapred/Reporter.html" title="interface in org.apache.hadoop.mapred">Reporter</A> reporter)</CODE> |
---|
| 248 | |
---|
| 249 | <BR> |
---|
| 250 | Chains the <code>reduce(...)</code> method of the Reducer with the |
---|
| 251 | <code>map(...) </code> methods of the Mappers in the chain.</TD> |
---|
| 252 | </TR> |
---|
| 253 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 254 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
| 255 | <CODE>static |
---|
| 256 | <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
---|
| 257 | <TR ALIGN="right" VALIGN=""> |
---|
| 258 | <TD NOWRAP><FONT SIZE="-1"> |
---|
| 259 | <CODE><K1,V1,K2,V2> |
---|
| 260 | <BR> |
---|
| 261 | void</CODE></FONT></TD> |
---|
| 262 | </TR> |
---|
| 263 | </TABLE> |
---|
| 264 | </CODE></FONT></TD> |
---|
| 265 | <TD><CODE><B><A HREF="../../../../../org/apache/hadoop/mapred/lib/ChainReducer.html#setReducer(org.apache.hadoop.mapred.JobConf, java.lang.Class, java.lang.Class, java.lang.Class, java.lang.Class, java.lang.Class, boolean, org.apache.hadoop.mapred.JobConf)">setReducer</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> job, |
---|
| 266 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/mapred/Reducer.html" title="interface in org.apache.hadoop.mapred">Reducer</A><K1,V1,K2,V2>> klass, |
---|
| 267 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends K1> inputKeyClass, |
---|
| 268 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends V1> inputValueClass, |
---|
| 269 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends K2> outputKeyClass, |
---|
| 270 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends V2> outputValueClass, |
---|
| 271 | boolean byValue, |
---|
| 272 | <A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> reducerConf)</CODE> |
---|
| 273 | |
---|
| 274 | <BR> |
---|
| 275 | Sets the Reducer class to the chain job's JobConf.</TD> |
---|
| 276 | </TR> |
---|
| 277 | </TABLE> |
---|
| 278 | <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> |
---|
| 279 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 280 | <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> |
---|
| 281 | <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> |
---|
| 282 | </TR> |
---|
| 283 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
| 284 | <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> |
---|
| 285 | </TR> |
---|
| 286 | </TABLE> |
---|
| 287 | |
---|
| 288 | <P> |
---|
| 289 | |
---|
| 290 | <!-- ========= CONSTRUCTOR DETAIL ======== --> |
---|
| 291 | |
---|
| 292 | <A NAME="constructor_detail"><!-- --></A> |
---|
| 293 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 294 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
| 295 | <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
---|
| 296 | <B>Constructor Detail</B></FONT></TH> |
---|
| 297 | </TR> |
---|
| 298 | </TABLE> |
---|
| 299 | |
---|
| 300 | <A NAME="ChainReducer()"><!-- --></A><H3> |
---|
| 301 | ChainReducer</H3> |
---|
| 302 | <PRE> |
---|
| 303 | public <B>ChainReducer</B>()</PRE> |
---|
| 304 | <DL> |
---|
| 305 | <DD>Constructor. |
---|
| 306 | <P> |
---|
| 307 | </DL> |
---|
| 308 | |
---|
| 309 | <!-- ============ METHOD DETAIL ========== --> |
---|
| 310 | |
---|
| 311 | <A NAME="method_detail"><!-- --></A> |
---|
| 312 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
| 313 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
| 314 | <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
---|
| 315 | <B>Method Detail</B></FONT></TH> |
---|
| 316 | </TR> |
---|
| 317 | </TABLE> |
---|
| 318 | |
---|
| 319 | <A NAME="setReducer(org.apache.hadoop.mapred.JobConf, java.lang.Class, java.lang.Class, java.lang.Class, java.lang.Class, java.lang.Class, boolean, org.apache.hadoop.mapred.JobConf)"><!-- --></A><H3> |
---|
| 320 | setReducer</H3> |
---|
| 321 | <PRE> |
---|
| 322 | public static <K1,V1,K2,V2> void <B>setReducer</B>(<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> job, |
---|
| 323 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/mapred/Reducer.html" title="interface in org.apache.hadoop.mapred">Reducer</A><K1,V1,K2,V2>> klass, |
---|
| 324 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends K1> inputKeyClass, |
---|
| 325 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends V1> inputValueClass, |
---|
| 326 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends K2> outputKeyClass, |
---|
| 327 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends V2> outputValueClass, |
---|
| 328 | boolean byValue, |
---|
| 329 | <A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> reducerConf)</PRE> |
---|
| 330 | <DL> |
---|
| 331 | <DD>Sets the Reducer class to the chain job's JobConf. |
---|
| 332 | <p/> |
---|
| 333 | It has to be specified how key and values are passed from one element of |
---|
| 334 | the chain to the next, by value or by reference. If a Reducer leverages the |
---|
| 335 | assumed semantics that the key and values are not modified by the collector |
---|
| 336 | 'by value' must be used. If the Reducer does not expect this semantics, as |
---|
| 337 | an optimization to avoid serialization and deserialization 'by reference' |
---|
| 338 | can be used. |
---|
| 339 | <p/> |
---|
| 340 | For the added Reducer the configuration given for it, |
---|
| 341 | <code>reducerConf</code>, have precedence over the job's JobConf. This |
---|
| 342 | precedence is in effect when the task is running. |
---|
| 343 | <p/> |
---|
| 344 | IMPORTANT: There is no need to specify the output key/value classes for the |
---|
| 345 | ChainReducer, this is done by the setReducer or the addMapper for the last |
---|
| 346 | element in the chain. |
---|
| 347 | <P> |
---|
| 348 | <DD><DL> |
---|
| 349 | </DL> |
---|
| 350 | </DD> |
---|
| 351 | <DD><DL> |
---|
| 352 | <DT><B>Parameters:</B><DD><CODE>job</CODE> - job's JobConf to add the Reducer class.<DD><CODE>klass</CODE> - the Reducer class to add.<DD><CODE>inputKeyClass</CODE> - reducer input key class.<DD><CODE>inputValueClass</CODE> - reducer input value class.<DD><CODE>outputKeyClass</CODE> - reducer output key class.<DD><CODE>outputValueClass</CODE> - reducer output value class.<DD><CODE>byValue</CODE> - indicates if key/values should be passed by value |
---|
| 353 | to the next Mapper in the chain, if any.<DD><CODE>reducerConf</CODE> - a JobConf with the configuration for the Reducer |
---|
| 354 | class. It is recommended to use a JobConf without default values using the |
---|
| 355 | <code>JobConf(boolean loadDefaults)</code> constructor with FALSE.</DL> |
---|
| 356 | </DD> |
---|
| 357 | </DL> |
---|
| 358 | <HR> |
---|
| 359 | |
---|
| 360 | <A NAME="addMapper(org.apache.hadoop.mapred.JobConf, java.lang.Class, java.lang.Class, java.lang.Class, java.lang.Class, java.lang.Class, boolean, org.apache.hadoop.mapred.JobConf)"><!-- --></A><H3> |
---|
| 361 | addMapper</H3> |
---|
| 362 | <PRE> |
---|
| 363 | public static <K1,V1,K2,V2> void <B>addMapper</B>(<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> job, |
---|
| 364 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/mapred/Mapper.html" title="interface in org.apache.hadoop.mapred">Mapper</A><K1,V1,K2,V2>> klass, |
---|
| 365 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends K1> inputKeyClass, |
---|
| 366 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends V1> inputValueClass, |
---|
| 367 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends K2> outputKeyClass, |
---|
| 368 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends V2> outputValueClass, |
---|
| 369 | boolean byValue, |
---|
| 370 | <A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> mapperConf)</PRE> |
---|
| 371 | <DL> |
---|
| 372 | <DD>Adds a Mapper class to the chain job's JobConf. |
---|
| 373 | <p/> |
---|
| 374 | It has to be specified how key and values are passed from one element of |
---|
| 375 | the chain to the next, by value or by reference. If a Mapper leverages the |
---|
| 376 | assumed semantics that the key and values are not modified by the collector |
---|
| 377 | 'by value' must be used. If the Mapper does not expect this semantics, as |
---|
| 378 | an optimization to avoid serialization and deserialization 'by reference' |
---|
| 379 | can be used. |
---|
| 380 | <p/> |
---|
| 381 | For the added Mapper the configuration given for it, |
---|
| 382 | <code>mapperConf</code>, have precedence over the job's JobConf. This |
---|
| 383 | precedence is in effect when the task is running. |
---|
| 384 | <p/> |
---|
| 385 | IMPORTANT: There is no need to specify the output key/value classes for the |
---|
| 386 | ChainMapper, this is done by the addMapper for the last mapper in the chain |
---|
| 387 | . |
---|
| 388 | <P> |
---|
| 389 | <DD><DL> |
---|
| 390 | </DL> |
---|
| 391 | </DD> |
---|
| 392 | <DD><DL> |
---|
| 393 | <DT><B>Parameters:</B><DD><CODE>job</CODE> - chain job's JobConf to add the Mapper class.<DD><CODE>klass</CODE> - the Mapper class to add.<DD><CODE>inputKeyClass</CODE> - mapper input key class.<DD><CODE>inputValueClass</CODE> - mapper input value class.<DD><CODE>outputKeyClass</CODE> - mapper output key class.<DD><CODE>outputValueClass</CODE> - mapper output value class.<DD><CODE>byValue</CODE> - indicates if key/values should be passed by value |
---|
| 394 | to the next Mapper in the chain, if any.<DD><CODE>mapperConf</CODE> - a JobConf with the configuration for the Mapper |
---|
| 395 | class. It is recommended to use a JobConf without default values using the |
---|
| 396 | <code>JobConf(boolean loadDefaults)</code> constructor with FALSE.</DL> |
---|
| 397 | </DD> |
---|
| 398 | </DL> |
---|
| 399 | <HR> |
---|
| 400 | |
---|
| 401 | <A NAME="configure(org.apache.hadoop.mapred.JobConf)"><!-- --></A><H3> |
---|
| 402 | configure</H3> |
---|
| 403 | <PRE> |
---|
| 404 | public void <B>configure</B>(<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> job)</PRE> |
---|
| 405 | <DL> |
---|
| 406 | <DD>Configures the ChainReducer, the Reducer and all the Mappers in the chain. |
---|
| 407 | <p/> |
---|
| 408 | If this method is overriden <code>super.configure(...)</code> should be |
---|
| 409 | invoked at the beginning of the overwriter method. |
---|
| 410 | <P> |
---|
| 411 | <DD><DL> |
---|
| 412 | <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/hadoop/mapred/JobConfigurable.html#configure(org.apache.hadoop.mapred.JobConf)">configure</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/hadoop/mapred/JobConfigurable.html" title="interface in org.apache.hadoop.mapred">JobConfigurable</A></CODE></DL> |
---|
| 413 | </DD> |
---|
| 414 | <DD><DL> |
---|
| 415 | <DT><B>Parameters:</B><DD><CODE>job</CODE> - the configuration</DL> |
---|
| 416 | </DD> |
---|
| 417 | </DL> |
---|
| 418 | <HR> |
---|
| 419 | |
---|
| 420 | <A NAME="reduce(java.lang.Object, java.util.Iterator, org.apache.hadoop.mapred.OutputCollector, org.apache.hadoop.mapred.Reporter)"><!-- --></A><H3> |
---|
| 421 | reduce</H3> |
---|
| 422 | <PRE> |
---|
| 423 | public void <B>reduce</B>(<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> key, |
---|
| 424 | <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A> values, |
---|
| 425 | <A HREF="../../../../../org/apache/hadoop/mapred/OutputCollector.html" title="interface in org.apache.hadoop.mapred">OutputCollector</A> output, |
---|
| 426 | <A HREF="../../../../../org/apache/hadoop/mapred/Reporter.html" title="interface in org.apache.hadoop.mapred">Reporter</A> reporter) |
---|
| 427 | 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></PRE> |
---|
| 428 | <DL> |
---|
| 429 | <DD>Chains the <code>reduce(...)</code> method of the Reducer with the |
---|
| 430 | <code>map(...) </code> methods of the Mappers in the chain. |
---|
| 431 | <P> |
---|
| 432 | <DD><DL> |
---|
| 433 | <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/hadoop/mapred/Reducer.html#reduce(K2, java.util.Iterator, org.apache.hadoop.mapred.OutputCollector, org.apache.hadoop.mapred.Reporter)">reduce</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/hadoop/mapred/Reducer.html" title="interface in org.apache.hadoop.mapred">Reducer</A></CODE></DL> |
---|
| 434 | </DD> |
---|
| 435 | <DD><DL> |
---|
| 436 | <DT><B>Parameters:</B><DD><CODE>key</CODE> - the key.<DD><CODE>values</CODE> - the list of values to reduce.<DD><CODE>output</CODE> - to collect keys and combined values.<DD><CODE>reporter</CODE> - facility to report progress. |
---|
| 437 | <DT><B>Throws:</B> |
---|
| 438 | <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></DL> |
---|
| 439 | </DD> |
---|
| 440 | </DL> |
---|
| 441 | <HR> |
---|
| 442 | |
---|
| 443 | <A NAME="close()"><!-- --></A><H3> |
---|
| 444 | close</H3> |
---|
| 445 | <PRE> |
---|
| 446 | public void <B>close</B>() |
---|
| 447 | 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></PRE> |
---|
| 448 | <DL> |
---|
| 449 | <DD>Closes the ChainReducer, the Reducer and all the Mappers in the chain. |
---|
| 450 | <p/> |
---|
| 451 | If this method is overriden <code>super.close()</code> should be |
---|
| 452 | invoked at the end of the overwriter method. |
---|
| 453 | <P> |
---|
| 454 | <DD><DL> |
---|
| 455 | <DT><B>Specified by:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true#close()" title="class or interface in java.io">close</A></CODE> in interface <CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</A></CODE></DL> |
---|
| 456 | </DD> |
---|
| 457 | <DD><DL> |
---|
| 458 | |
---|
| 459 | <DT><B>Throws:</B> |
---|
| 460 | <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></DL> |
---|
| 461 | </DD> |
---|
| 462 | </DL> |
---|
| 463 | <!-- ========= END OF CLASS DATA ========= --> |
---|
| 464 | <HR> |
---|
| 465 | |
---|
| 466 | |
---|
| 467 | <!-- ======= START OF BOTTOM NAVBAR ====== --> |
---|
| 468 | <A NAME="navbar_bottom"><!-- --></A> |
---|
| 469 | <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
---|
| 470 | <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
---|
| 471 | <TR> |
---|
| 472 | <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
---|
| 473 | <A NAME="navbar_bottom_firstrow"><!-- --></A> |
---|
| 474 | <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
---|
| 475 | <TR ALIGN="center" VALIGN="top"> |
---|
| 476 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
---|
| 477 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
---|
| 478 | <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
---|
| 479 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ChainReducer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
---|
| 480 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
---|
| 481 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
---|
| 482 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
---|
| 483 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
---|
| 484 | </TR> |
---|
| 485 | </TABLE> |
---|
| 486 | </TD> |
---|
| 487 | <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
---|
| 488 | </EM> |
---|
| 489 | </TD> |
---|
| 490 | </TR> |
---|
| 491 | |
---|
| 492 | <TR> |
---|
| 493 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
| 494 | <A HREF="../../../../../org/apache/hadoop/mapred/lib/ChainMapper.html" title="class in org.apache.hadoop.mapred.lib"><B>PREV CLASS</B></A> |
---|
| 495 | <A HREF="../../../../../org/apache/hadoop/mapred/lib/CombineFileInputFormat.html" title="class in org.apache.hadoop.mapred.lib"><B>NEXT CLASS</B></A></FONT></TD> |
---|
| 496 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
| 497 | <A HREF="../../../../../index.html?org/apache/hadoop/mapred/lib/ChainReducer.html" target="_top"><B>FRAMES</B></A> |
---|
| 498 | <A HREF="ChainReducer.html" target="_top"><B>NO FRAMES</B></A> |
---|
| 499 | <SCRIPT type="text/javascript"> |
---|
| 500 | <!-- |
---|
| 501 | if(window==top) { |
---|
| 502 | document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
---|
| 503 | } |
---|
| 504 | //--> |
---|
| 505 | </SCRIPT> |
---|
| 506 | <NOSCRIPT> |
---|
| 507 | <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> |
---|
| 508 | </NOSCRIPT> |
---|
| 509 | |
---|
| 510 | |
---|
| 511 | </FONT></TD> |
---|
| 512 | </TR> |
---|
| 513 | <TR> |
---|
| 514 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
| 515 | SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
---|
| 516 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
| 517 | DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> |
---|
| 518 | </TR> |
---|
| 519 | </TABLE> |
---|
| 520 | <A NAME="skip-navbar_bottom"></A> |
---|
| 521 | <!-- ======== END OF BOTTOM NAVBAR ======= --> |
---|
| 522 | |
---|
| 523 | <HR> |
---|
| 524 | Copyright © 2009 The Apache Software Foundation |
---|
| 525 | </BODY> |
---|
| 526 | </HTML> |
---|