source: proiecte/HadoopJUnit/hadoop-0.20.1/docs/api/org/apache/hadoop/mapreduce/Partitioner.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: 13.9 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>
7Partitioner (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="Partitioner (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/Partitioner.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/OutputFormat.html" title="class in org.apache.hadoop.mapreduce"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../org/apache/hadoop/mapreduce/RecordReader.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/Partitioner.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="Partitioner.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;NESTED&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 Partitioner&lt;KEY,VALUE&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.Partitioner&lt;KEY,VALUE&gt;</B>
97</PRE>
98<DL>
99<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/apache/hadoop/mapreduce/lib/partition/HashPartitioner.html" title="class in org.apache.hadoop.mapreduce.lib.partition">HashPartitioner</A>, <A HREF="../../../../org/apache/hadoop/examples/SecondarySort.FirstPartitioner.html" title="class in org.apache.hadoop.examples">SecondarySort.FirstPartitioner</A></DD>
100</DL>
101<HR>
102<DL>
103<DT><PRE>public abstract class <B>Partitioner&lt;KEY,VALUE&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>
107Partitions the key space.
108 
109 <p><code>Partitioner</code> controls the partitioning of the keys of the
110 intermediate map-outputs. The key (or a subset of the key) is used to derive
111 the partition, typically by a hash function. The total number of partitions
112 is the same as the number of reduce tasks for the job. Hence this controls
113 which of the <code>m</code> reduce tasks the intermediate key (and hence the
114 record) is sent for reduction.</p>
115<P>
116
117<P>
118<DL>
119<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/hadoop/mapreduce/Reducer.html" title="class in org.apache.hadoop.mapreduce"><CODE>Reducer</CODE></A></DL>
120<HR>
121
122<P>
123
124<!-- ======== CONSTRUCTOR SUMMARY ======== -->
125
126<A NAME="constructor_summary"><!-- --></A>
127<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
128<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
129<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
130<B>Constructor Summary</B></FONT></TH>
131</TR>
132<TR BGCOLOR="white" CLASS="TableRowColor">
133<TD><CODE><B><A HREF="../../../../org/apache/hadoop/mapreduce/Partitioner.html#Partitioner()">Partitioner</A></B>()</CODE>
134
135<BR>
136&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
137</TR>
138</TABLE>
139&nbsp;
140<!-- ========== METHOD SUMMARY =========== -->
141
142<A NAME="method_summary"><!-- --></A>
143<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
144<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
145<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
146<B>Method Summary</B></FONT></TH>
147</TR>
148<TR BGCOLOR="white" CLASS="TableRowColor">
149<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
150<CODE>abstract &nbsp;int</CODE></FONT></TD>
151<TD><CODE><B><A HREF="../../../../org/apache/hadoop/mapreduce/Partitioner.html#getPartition(KEY, VALUE, int)">getPartition</A></B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Partitioner.html" title="type parameter in Partitioner">KEY</A>&nbsp;key,
152             <A HREF="../../../../org/apache/hadoop/mapreduce/Partitioner.html" title="type parameter in Partitioner">VALUE</A>&nbsp;value,
153             int&nbsp;numPartitions)</CODE>
154
155<BR>
156&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the partition number for a given key (hence record) given the total
157 number of partitions i.e.</TD>
158</TR>
159</TABLE>
160&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
161<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
162<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
163<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>
164</TR>
165<TR BGCOLOR="white" CLASS="TableRowColor">
166<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>
167</TR>
168</TABLE>
169&nbsp;
170<P>
171
172<!-- ========= CONSTRUCTOR DETAIL ======== -->
173
174<A NAME="constructor_detail"><!-- --></A>
175<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
176<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
177<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
178<B>Constructor Detail</B></FONT></TH>
179</TR>
180</TABLE>
181
182<A NAME="Partitioner()"><!-- --></A><H3>
183Partitioner</H3>
184<PRE>
185public <B>Partitioner</B>()</PRE>
186<DL>
187</DL>
188
189<!-- ============ METHOD DETAIL ========== -->
190
191<A NAME="method_detail"><!-- --></A>
192<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
193<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
194<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
195<B>Method Detail</B></FONT></TH>
196</TR>
197</TABLE>
198
199<A NAME="getPartition(java.lang.Object,java.lang.Object,int)"><!-- --></A><A NAME="getPartition(KEY, VALUE, int)"><!-- --></A><H3>
200getPartition</H3>
201<PRE>
202public abstract int <B>getPartition</B>(<A HREF="../../../../org/apache/hadoop/mapreduce/Partitioner.html" title="type parameter in Partitioner">KEY</A>&nbsp;key,
203                                 <A HREF="../../../../org/apache/hadoop/mapreduce/Partitioner.html" title="type parameter in Partitioner">VALUE</A>&nbsp;value,
204                                 int&nbsp;numPartitions)</PRE>
205<DL>
206<DD>Get the partition number for a given key (hence record) given the total
207 number of partitions i.e. number of reduce-tasks for the job.
208   
209 <p>Typically a hash function on a all or a subset of the key.</p>
210<P>
211<DD><DL>
212<DT><B>Parameters:</B><DD><CODE>key</CODE> - the key to be partioned.<DD><CODE>value</CODE> - the entry value.<DD><CODE>numPartitions</CODE> - the total number of partitions.
213<DT><B>Returns:</B><DD>the partition number for the <code>key</code>.</DL>
214</DD>
215</DL>
216<!-- ========= END OF CLASS DATA ========= -->
217<HR>
218
219
220<!-- ======= START OF BOTTOM NAVBAR ====== -->
221<A NAME="navbar_bottom"><!-- --></A>
222<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
223<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
224<TR>
225<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
226<A NAME="navbar_bottom_firstrow"><!-- --></A>
227<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
228  <TR ALIGN="center" VALIGN="top">
229  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
230  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
231  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
232  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Partitioner.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
233  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
234  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
235  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
236  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
237  </TR>
238</TABLE>
239</TD>
240<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
241</EM>
242</TD>
243</TR>
244
245<TR>
246<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
247&nbsp;<A HREF="../../../../org/apache/hadoop/mapreduce/OutputFormat.html" title="class in org.apache.hadoop.mapreduce"><B>PREV CLASS</B></A>&nbsp;
248&nbsp;<A HREF="../../../../org/apache/hadoop/mapreduce/RecordReader.html" title="class in org.apache.hadoop.mapreduce"><B>NEXT CLASS</B></A></FONT></TD>
249<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
250  <A HREF="../../../../index.html?org/apache/hadoop/mapreduce/Partitioner.html" target="_top"><B>FRAMES</B></A>  &nbsp;
251&nbsp;<A HREF="Partitioner.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
252&nbsp;<SCRIPT type="text/javascript">
253  <!--
254  if(window==top) {
255    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
256  }
257  //-->
258</SCRIPT>
259<NOSCRIPT>
260  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
261</NOSCRIPT>
262
263
264</FONT></TD>
265</TR>
266<TR>
267<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
268  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
269<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
270DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
271</TR>
272</TABLE>
273<A NAME="skip-navbar_bottom"></A>
274<!-- ======== END OF BOTTOM NAVBAR ======= -->
275
276<HR>
277Copyright &copy; 2009 The Apache Software Foundation
278</BODY>
279</HTML>
Note: See TracBrowser for help on using the repository browser.