<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Sort the output of a MapReduce job in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Sort-the-output-of-a-MapReduce-job/m-p/131004#M23096</link>
    <description>&lt;P&gt;Sorting in MR applies to two areas:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Sort output by keys&lt;/STRONG&gt;: this done "naturally" in the sense that the keys are sorted as they come into the reducer. The compareTo method in the key class determines this natural sorting&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Secondary sort&lt;/STRONG&gt;: both the keys and values are sorted. That involves writing a group comparator class and then registering that class with the MR Job using the setGroupingComparator class&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The exam objective you listed above is referring to both. The first one is fairly straightforward - you implement the compareTo method in your key class. The secondary sort involves a bit more work. There is a nice blog here that has an example of how to implement a secondary sort:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="https://community.cloudera.com/"&gt;https://vangjee.wordpress.com/2012/03/20/secondary-sorting-aka-sorting-values-in-hadoops-mapreduce-programming-paradigm/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Mar 2016 21:42:38 GMT</pubDate>
    <dc:creator>rich1</dc:creator>
    <dc:date>2016-03-16T21:42:38Z</dc:date>
    <item>
      <title>Sort the output of a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Sort-the-output-of-a-MapReduce-job/m-p/131003#M23095</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/164/rich.html" nodeid="164" target="_blank"&gt;@Rich Raposa&lt;/A&gt; &lt;/P&gt;&lt;P&gt;One of the objective in HDPCD:Java exam is to sort "output" of MR job using 
&lt;A href="http://hadoop.apache.org/docs/r2.6.0/api/org/apache/hadoop/mapreduce/Job.html#setGroupingComparatorClass(java.lang.Class)" target="_blank"&gt;http://hadoop.apache.org/docs/r2.6.0/api/org/apache/hadoop/mapreduce/Job.html#setGroupingComparatorClass(java.lang.Class)&lt;/A&gt;
My understanding is grouping comparator is for grouping records from multiple partitions. How can this be used for sorting?
Do you mean using setSortComparatorClass?&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:09:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Sort-the-output-of-a-MapReduce-job/m-p/131003#M23095</guid>
      <dc:creator>ungarala</dc:creator>
      <dc:date>2022-09-16T10:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Sort the output of a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Sort-the-output-of-a-MapReduce-job/m-p/131004#M23096</link>
      <description>&lt;P&gt;Sorting in MR applies to two areas:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Sort output by keys&lt;/STRONG&gt;: this done "naturally" in the sense that the keys are sorted as they come into the reducer. The compareTo method in the key class determines this natural sorting&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Secondary sort&lt;/STRONG&gt;: both the keys and values are sorted. That involves writing a group comparator class and then registering that class with the MR Job using the setGroupingComparator class&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The exam objective you listed above is referring to both. The first one is fairly straightforward - you implement the compareTo method in your key class. The secondary sort involves a bit more work. There is a nice blog here that has an example of how to implement a secondary sort:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="https://community.cloudera.com/"&gt;https://vangjee.wordpress.com/2012/03/20/secondary-sorting-aka-sorting-values-in-hadoops-mapreduce-programming-paradigm/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 21:42:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Sort-the-output-of-a-MapReduce-job/m-p/131004#M23096</guid>
      <dc:creator>rich1</dc:creator>
      <dc:date>2016-03-16T21:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sort the output of a MapReduce job</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Sort-the-output-of-a-MapReduce-job/m-p/131005#M23097</link>
      <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/164/rich.html" nodeid="164"&gt;@Rich Raposa&lt;/A&gt;. It was actually little confusing to see ONLY setGroupingComparator mentioned in the objective, while secondary-sort involves writing comparator classes for sorting/grouping and using both setSortComparatorClass and setGroupingComparator methods.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 22:38:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Sort-the-output-of-a-MapReduce-job/m-p/131005#M23097</guid>
      <dc:creator>ungarala</dc:creator>
      <dc:date>2016-03-16T22:38:15Z</dc:date>
    </item>
  </channel>
</rss>

