source: proiecte/HadoopJUnit/hadoop-0.20.1/src/mapred/org/apache/hadoop/mapreduce/OutputFormat.java @ 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: 2.9 KB
Line 
1/**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19package org.apache.hadoop.mapreduce;
20
21import java.io.IOException;
22
23import org.apache.hadoop.fs.FileSystem;
24
25/**
26 * <code>OutputFormat</code> describes the output-specification for a
27 * Map-Reduce job.
28 *
29 * <p>The Map-Reduce framework relies on the <code>OutputFormat</code> of the
30 * job to:<p>
31 * <ol>
32 *   <li>
33 *   Validate the output-specification of the job. For e.g. check that the
34 *   output directory doesn't already exist.
35 *   <li>
36 *   Provide the {@link RecordWriter} implementation to be used to write out
37 *   the output files of the job. Output files are stored in a
38 *   {@link FileSystem}.
39 *   </li>
40 * </ol>
41 *
42 * @see RecordWriter
43 */
44public abstract class OutputFormat<K, V> {
45
46  /**
47   * Get the {@link RecordWriter} for the given task.
48   *
49   * @param context the information about the current task.
50   * @return a {@link RecordWriter} to write the output for the job.
51   * @throws IOException
52   */
53  public abstract RecordWriter<K, V> 
54    getRecordWriter(TaskAttemptContext context
55                    ) throws IOException, InterruptedException;
56
57  /**
58   * Check for validity of the output-specification for the job.
59   * 
60   * <p>This is to validate the output specification for the job when it is
61   * a job is submitted.  Typically checks that it does not already exist,
62   * throwing an exception when it already exists, so that output is not
63   * overwritten.</p>
64   *
65   * @param context information about the job
66   * @throws IOException when output should not be attempted
67   */
68  public abstract void checkOutputSpecs(JobContext context
69                                        ) throws IOException, 
70                                                 InterruptedException;
71
72  /**
73   * Get the output committer for this output format. This is responsible
74   * for ensuring the output is committed correctly.
75   * @param context the task context
76   * @return an output committer
77   * @throws IOException
78   * @throws InterruptedException
79   */
80  public abstract 
81  OutputCommitter getOutputCommitter(TaskAttemptContext context
82                                     ) throws IOException, InterruptedException;
83}
84
Note: See TracBrowser for help on using the repository browser.