| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_292) on Tue Jun 15 06:00:54 GMT 2021 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>MultipleOutputs (Apache Hadoop Main 3.3.1 API)</title> |
| <meta name="date" content="2021-06-15"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="MultipleOutputs (Apache Hadoop Main 3.3.1 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":9,"i1":10,"i2":9,"i3":9,"i4":10,"i5":10,"i6":10}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/MultipleOutputs.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MapFileOutputFormat.html" title="class in org.apache.hadoop.mapreduce.lib.output"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/NullOutputFormat.html" title="class in org.apache.hadoop.mapreduce.lib.output"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../index.html?org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" target="_top">Frames</a></li> |
| <li><a href="MultipleOutputs.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.hadoop.mapreduce.lib.output</div> |
| <h2 title="Class MultipleOutputs" class="title">Class MultipleOutputs<KEYOUT,VALUEOUT></h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.hadoop.mapreduce.lib.output.MultipleOutputs<KEYOUT,VALUEOUT></li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>@InterfaceAudience.Public |
| @InterfaceStability.Stable |
| public class <span class="typeNameLabel">MultipleOutputs<KEYOUT,VALUEOUT></span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> |
| <div class="block">The MultipleOutputs class simplifies writing output data |
| to multiple outputs |
| |
| <p> |
| Case one: writing to additional outputs other than the job default output. |
| |
| Each additional output, or named output, may be configured with its own |
| <code>OutputFormat</code>, with its own key class and with its own value |
| class. |
| </p> |
| |
| <p> |
| Case two: to write data to different files provided by user |
| </p> |
| |
| <p> |
| MultipleOutputs supports counters, by default they are disabled. The |
| counters group is the <a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="class in org.apache.hadoop.mapreduce.lib.output"><code>MultipleOutputs</code></a> class name. The names of the |
| counters are the same as the output name. These count the number records |
| written to each output name. |
| </p> |
| |
| Usage pattern for job submission: |
| <pre> |
| |
| Job job = new Job(); |
| |
| FileInputFormat.setInputPath(job, inDir); |
| FileOutputFormat.setOutputPath(job, outDir); |
| |
| job.setMapperClass(MOMap.class); |
| job.setReducerClass(MOReduce.class); |
| ... |
| |
| // Defines additional single text based output 'text' for the job |
| MultipleOutputs.addNamedOutput(job, "text", TextOutputFormat.class, |
| LongWritable.class, Text.class); |
| |
| // Defines additional sequence-file based output 'sequence' for the job |
| MultipleOutputs.addNamedOutput(job, "seq", |
| SequenceFileOutputFormat.class, |
| LongWritable.class, Text.class); |
| ... |
| |
| job.waitForCompletion(true); |
| ... |
| </pre> |
| <p> |
| Usage in Reducer: |
| <pre> |
| <K, V> String generateFileName(K k, V v) { |
| return k.toString() + "_" + v.toString(); |
| } |
| |
| public class MOReduce extends |
| Reducer<WritableComparable, Writable,WritableComparable, Writable> { |
| private MultipleOutputs mos; |
| public void setup(Context context) { |
| ... |
| mos = new MultipleOutputs(context); |
| } |
| |
| public void reduce(WritableComparable key, Iterator<Writable> values, |
| Context context) |
| throws IOException { |
| ... |
| mos.write("text", , key, new Text("Hello")); |
| mos.write("seq", LongWritable(1), new Text("Bye"), "seq_a"); |
| mos.write("seq", LongWritable(2), key, new Text("Chau"), "seq_b"); |
| mos.write(key, new Text("value"), generateFileName(key, new Text("value"))); |
| ... |
| } |
| |
| public void cleanup(Context) throws IOException { |
| mos.close(); |
| ... |
| } |
| |
| } |
| </pre> |
| |
| <p> |
| When used in conjuction with org.apache.hadoop.mapreduce.lib.output.LazyOutputFormat, |
| MultipleOutputs can mimic the behaviour of MultipleTextOutputFormat and MultipleSequenceFileOutputFormat |
| from the old Hadoop API - ie, output can be written from the Reducer to more than one location. |
| </p> |
| |
| <p> |
| Use <code>MultipleOutputs.write(KEYOUT key, VALUEOUT value, String baseOutputPath)</code> to write key and |
| value to a path specified by <code>baseOutputPath</code>, with no need to specify a named output. |
| <b>Warning</b>: when the baseOutputPath passed to MultipleOutputs.write |
| is a path that resolves outside of the final job output directory, the |
| directory is created immediately and then persists through subsequent |
| task retries, breaking the concept of output committing: |
| </p> |
| |
| <pre> |
| private MultipleOutputs<Text, Text> out; |
| |
| public void setup(Context context) { |
| out = new MultipleOutputs<Text, Text>(context); |
| ... |
| } |
| |
| public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException { |
| for (Text t : values) { |
| out.write(key, t, generateFileName(<<i>parameter list...</i>>)); |
| } |
| } |
| |
| protected void cleanup(Context context) throws IOException, InterruptedException { |
| out.close(); |
| } |
| </pre> |
| |
| <p> |
| Use your own code in <code>generateFileName()</code> to create a custom path to your results. |
| '/' characters in <code>baseOutputPath</code> will be translated into directory levels in your file system. |
| Also, append your custom-generated path with "part" or similar, otherwise your output will be -00000, -00001 etc. |
| No call to <code>context.write()</code> is necessary. See example <code>generateFileName()</code> code below. |
| </p> |
| |
| <pre> |
| private String generateFileName(Text k) { |
| // expect Text k in format "Surname|Forename" |
| String[] kStr = k.toString().split("\\|"); |
| |
| String sName = kStr[0]; |
| String fName = kStr[1]; |
| |
| // example for k = Smith|John |
| // output written to /user/hadoop/path/to/output/Smith/John-r-00000 (etc) |
| return sName + "/" + fName; |
| } |
| </pre> |
| |
| <p> |
| Using MultipleOutputs in this way will still create zero-sized default output, eg part-00000. |
| To prevent this use <code>LazyOutputFormat.setOutputFormatClass(job, TextOutputFormat.class);</code> |
| instead of <code>job.setOutputFormatClass(TextOutputFormat.class);</code> in your Hadoop job configuration. |
| </p></div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html#MultipleOutputs-org.apache.hadoop.mapreduce.TaskInputOutputContext-">MultipleOutputs</a></span>(<a href="../../../../../../org/apache/hadoop/mapreduce/TaskInputOutputContext.html" title="interface in org.apache.hadoop.mapreduce">TaskInputOutputContext</a><?,?,<a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="type parameter in MultipleOutputs">KEYOUT</a>,<a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="type parameter in MultipleOutputs">VALUEOUT</a>> context)</code> |
| <div class="block">Creates and initializes multiple outputs support, |
| it should be instantiated in the Mapper/Reducer setup method.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html#addNamedOutput-org.apache.hadoop.mapreduce.Job-java.lang.String-java.lang.Class-java.lang.Class-java.lang.Class-">addNamedOutput</a></span>(<a href="../../../../../../org/apache/hadoop/mapreduce/Job.html" title="class in org.apache.hadoop.mapreduce">Job</a> job, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> namedOutput, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><? extends <a href="../../../../../../org/apache/hadoop/mapreduce/OutputFormat.html" title="class in org.apache.hadoop.mapreduce">OutputFormat</a>> outputFormatClass, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><?> keyClass, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><?> valueClass)</code> |
| <div class="block">Adds a named output for the job.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html#close--">close</a></span>()</code> |
| <div class="block">Closes all the opened outputs.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>static boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html#getCountersEnabled-org.apache.hadoop.mapreduce.JobContext-">getCountersEnabled</a></span>(<a href="../../../../../../org/apache/hadoop/mapreduce/JobContext.html" title="interface in org.apache.hadoop.mapreduce">JobContext</a> job)</code> |
| <div class="block">Returns if the counters for the named outputs are enabled or not.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html#setCountersEnabled-org.apache.hadoop.mapreduce.Job-boolean-">setCountersEnabled</a></span>(<a href="../../../../../../org/apache/hadoop/mapreduce/Job.html" title="class in org.apache.hadoop.mapreduce">Job</a> job, |
| boolean enabled)</code> |
| <div class="block">Enables or disables counters for the named outputs.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html#write-KEYOUT-VALUEOUT-java.lang.String-">write</a></span>(<a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="type parameter in MultipleOutputs">KEYOUT</a> key, |
| <a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="type parameter in MultipleOutputs">VALUEOUT</a> value, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> baseOutputPath)</code> |
| <div class="block">Write key value to an output file name.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><K,V> void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html#write-java.lang.String-K-V-">write</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> namedOutput, |
| K key, |
| V value)</code> |
| <div class="block">Write key and value to the namedOutput.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code><K,V> void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html#write-java.lang.String-K-V-java.lang.String-">write</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> namedOutput, |
| K key, |
| V value, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> baseOutputPath)</code> |
| <div class="block">Write key and value to baseOutputPath using the namedOutput.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="MultipleOutputs-org.apache.hadoop.mapreduce.TaskInputOutputContext-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>MultipleOutputs</h4> |
| <pre>public MultipleOutputs(<a href="../../../../../../org/apache/hadoop/mapreduce/TaskInputOutputContext.html" title="interface in org.apache.hadoop.mapreduce">TaskInputOutputContext</a><?,?,<a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="type parameter in MultipleOutputs">KEYOUT</a>,<a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="type parameter in MultipleOutputs">VALUEOUT</a>> context)</pre> |
| <div class="block">Creates and initializes multiple outputs support, |
| it should be instantiated in the Mapper/Reducer setup method.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>context</code> - the TaskInputOutputContext object</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="addNamedOutput-org.apache.hadoop.mapreduce.Job-java.lang.String-java.lang.Class-java.lang.Class-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addNamedOutput</h4> |
| <pre>public static void addNamedOutput(<a href="../../../../../../org/apache/hadoop/mapreduce/Job.html" title="class in org.apache.hadoop.mapreduce">Job</a> job, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> namedOutput, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><? extends <a href="../../../../../../org/apache/hadoop/mapreduce/OutputFormat.html" title="class in org.apache.hadoop.mapreduce">OutputFormat</a>> outputFormatClass, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><?> keyClass, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><?> valueClass)</pre> |
| <div class="block">Adds a named output for the job.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>job</code> - job to add the named output</dd> |
| <dd><code>namedOutput</code> - named output name, it has to be a word, letters |
| and numbers only, cannot be the word 'part' as |
| that is reserved for the default output.</dd> |
| <dd><code>outputFormatClass</code> - OutputFormat class.</dd> |
| <dd><code>keyClass</code> - key class</dd> |
| <dd><code>valueClass</code> - value class</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setCountersEnabled-org.apache.hadoop.mapreduce.Job-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setCountersEnabled</h4> |
| <pre>public static void setCountersEnabled(<a href="../../../../../../org/apache/hadoop/mapreduce/Job.html" title="class in org.apache.hadoop.mapreduce">Job</a> job, |
| boolean enabled)</pre> |
| <div class="block">Enables or disables counters for the named outputs. |
| |
| The counters group is the <a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="class in org.apache.hadoop.mapreduce.lib.output"><code>MultipleOutputs</code></a> class name. |
| The names of the counters are the same as the named outputs. These |
| counters count the number records written to each output name. |
| By default these counters are disabled.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>job</code> - job to enable counters</dd> |
| <dd><code>enabled</code> - indicates if the counters will be enabled or not.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getCountersEnabled-org.apache.hadoop.mapreduce.JobContext-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getCountersEnabled</h4> |
| <pre>public static boolean getCountersEnabled(<a href="../../../../../../org/apache/hadoop/mapreduce/JobContext.html" title="interface in org.apache.hadoop.mapreduce">JobContext</a> job)</pre> |
| <div class="block">Returns if the counters for the named outputs are enabled or not. |
| By default these counters are disabled.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>job</code> - the job</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>TRUE if the counters are enabled, FALSE if they are disabled.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-java.lang.Object-java.lang.Object-"> |
| <!-- --> |
| </a><a name="write-java.lang.String-K-V-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre>public <K,V> void write(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> namedOutput, |
| K key, |
| V value) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></pre> |
| <div class="block">Write key and value to the namedOutput. |
| |
| Output path is a unique file generated for the namedOutput. |
| For example, {namedOutput}-(m|r)-{part-number}</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>namedOutput</code> - the named output name</dd> |
| <dd><code>key</code> - the key</dd> |
| <dd><code>value</code> - the value</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-java.lang.Object-java.lang.Object-java.lang.String-"> |
| <!-- --> |
| </a><a name="write-java.lang.String-K-V-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre>public <K,V> void write(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> namedOutput, |
| K key, |
| V value, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> baseOutputPath) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></pre> |
| <div class="block">Write key and value to baseOutputPath using the namedOutput.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>namedOutput</code> - the named output name</dd> |
| <dd><code>key</code> - the key</dd> |
| <dd><code>value</code> - the value</dd> |
| <dd><code>baseOutputPath</code> - base-output path to write the record to. |
| Note: Framework will generate unique filename for the baseOutputPath |
| <b>Warning</b>: when the baseOutputPath is a path that resolves |
| outside of the final job output directory, the directory is created |
| immediately and then persists through subsequent task retries, breaking |
| the concept of output committing.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.Object-java.lang.Object-java.lang.String-"> |
| <!-- --> |
| </a><a name="write-KEYOUT-VALUEOUT-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre>public void write(<a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="type parameter in MultipleOutputs">KEYOUT</a> key, |
| <a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" title="type parameter in MultipleOutputs">VALUEOUT</a> value, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> baseOutputPath) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></pre> |
| <div class="block">Write key value to an output file name. |
| |
| Gets the record writer from job's output format. |
| Job's output format should be a FileOutputFormat.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>key</code> - the key</dd> |
| <dd><code>value</code> - the value</dd> |
| <dd><code>baseOutputPath</code> - base-output path to write the record to. |
| Note: Framework will generate unique filename for the baseOutputPath |
| <b>Warning</b>: when the baseOutputPath is a path that resolves |
| outside of the final job output directory, the directory is created |
| immediately and then persists through subsequent task retries, breaking |
| the concept of output committing.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="close--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>close</h4> |
| <pre>public void close() |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></pre> |
| <div class="block">Closes all the opened outputs. |
| |
| This should be called from cleanup method of map/reduce task. |
| If overridden subclasses must invoke <code>super.close()</code> at the |
| end of their <code>close()</code></div> |
| <dl> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/MultipleOutputs.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/MapFileOutputFormat.html" title="class in org.apache.hadoop.mapreduce.lib.output"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../../org/apache/hadoop/mapreduce/lib/output/NullOutputFormat.html" title="class in org.apache.hadoop.mapreduce.lib.output"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../index.html?org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" target="_top">Frames</a></li> |
| <li><a href="MultipleOutputs.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2021 <a href="https://www.apache.org">Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |