<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pattern on Bruno Pedro</title><link>https://brunopedro.com/tags/pattern/</link><description>Recent content in Pattern on Bruno Pedro</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 08 May 2018 10:00:15 -0700</lastBuildDate><atom:link href="https://brunopedro.com/tags/pattern/index.xml" rel="self" type="application/rss+xml"/><item><title>MapReduce related patterns</title><link>https://brunopedro.com/2011/09/26/mapreduce-related-patterns/</link><pubDate>Mon, 26 Sep 2011 21:16:15 +0000</pubDate><guid>https://brunopedro.com/2011/09/26/mapreduce-related-patterns/</guid><description>&lt;p>Here&amp;rsquo;s a list of possible MapReduce related patterns I&amp;rsquo;ve been thinking about:&lt;/p>
&lt;ul>
&lt;li>&lt;em>map-update&lt;/em>: update each mapped document and emit its updated or original version;&lt;/li>
&lt;li>&lt;em>map-delete&lt;/em>: delete each mapped document;&lt;/li>
&lt;li>&lt;em>map-reduce-map&lt;/em>: map results of a &lt;em>map-reduce&lt;/em>;&lt;/li>
&lt;li>&lt;em>map-map&lt;/em>: map results of a &lt;em>map&lt;/em>;&lt;/li>
&lt;li>&lt;em>map-recurse&lt;/em>: apply recursion to the mapping function until a stop condition occurs;&lt;/li>
&lt;li>any combination of patterns, e.g., &lt;em>map-reduce-map-update&lt;/em>.&lt;/li>
&lt;/ul>
&lt;p>Example usage:&lt;/p>
&lt;ul>
&lt;li>get the e-mail address of every customer with a negative balance: &lt;em>map-reduce-map&lt;/em>. First, &lt;em>map-reduce&lt;/em> to get the aggregate balance for each customer, then &lt;em>map&lt;/em> again to get only customers with negative value and emit their e-mail address;&lt;/li>
&lt;li>delete all documents older than one month: &lt;em>map-delete&lt;/em>. First, &lt;em>map&lt;/em> to get all documents older than one month and then &lt;em>delete&lt;/em> each one;&lt;/li>
&lt;li>get a list of documents and mark them as read: &lt;em>map-update&lt;/em>. First, &lt;em>map&lt;/em> to get the list of documents according to a given criteria, then &lt;em>update&lt;/em> each document marking it as read;&lt;/li>
&lt;li>and so on&amp;hellip;&lt;/li>
&lt;/ul></description></item></channel></rss>