Visualizing MapReduce Algorithm with an Example: Finding Max Temperature

Standard

Problem Statement: Find Maximum Temperature for a city from the Input data.

Step 1) Input Files:

File 1:

New-york, 25

Seattle, 21

New-york, 28

Dallas, 35

File 2:

New-york, 20

Seattle, 21

Seattle, 22

Dallas, 23

File 3:

New-york, 31

Seattle, 33

Dallas, 30

Dallas, 19

Step 2: Map Function

Let’s say Map1, Map2 & Map3 run on File1, File2 & File3 in parallel, Here is their output:

(Note how it outputs the “Key – Value” pair. The key would be used by the reduce function later to do a “group by“)

Map 1:

Seattle, 21

New-york, 28

Dallas, 35

Map 2:

New-york, 20

Seattle, 22

Dallas, 23

Map 3:

New-york, 31

Seattle, 33

Dallas, 30

Step 3: Reduce Function

Reduce Function takes the input from Map1, Map2 & Map3, to give an output:

New-york, 31

Seattle, 33

Dallas, 35

Conclusion:

In this post, we visualized MapReduce Programming Model with an example: Finding Max Temp. for a city.  And as you can imagine you can extend this post, to visualize:

1) Find Minimum Temperature for a city.

2) In this post, the key was City, But you could substitute it by other relevant real world entity to solve similar looking problems.

I hope this helps.

Related Articles:

Visualizing MapReduce Algorithm with WordCount Example

SQLPASS 2011 was amazing!

Standard

I had never attended a conference of this scale before – so for me, it was a novel experience! An experience I will cherish (Until I get a chance to attend the next PASS!). And I am just amazed at kind of work the PASS board and volunteers must have put in to make this all happen. I remember a time when I was a lead organizer for a national level technical festival for just 500 attendees – and trust me when I say I had no chance to rest for 3-4 weeks straight. So when I see a conference that is 10x in size and 100x in reputation – All I can do is stare in amazement:

image

(Image Courtesy: dpshots)

So what did I do at SQLPASS?!

– Attended sessions to learn, relearn (and unlearn!)

image

( Image courtesy: http://www.lubbockstarprogram.com/?page_id=37 )

– Attended keynotes! Awesome announcements!! And on day three, I had the pleasure of seeing Dr. Dewitt live! – it was awesome!

– Went to parties ( I loved the SolidQ party and the Game works party)

image

Image courtesy: http://www.watton.org/clipart/party/party.shtml

– Met Amazing people who are passionate about same things I am!

– Met people who are part of the team that are responsible for developing/delivering products that I use daily => Met people with blue badges!

– Slept a little!

– Explored Seattle after PASS summit

– Volunteered as PASS ambassador

What was my job?! To guide people to find what they were looking for. So what I had to scout for confused faces – offer then help – point them to places – that’s about it.

image

– And tweeted a little during SQLPASS! #sqlpass rocks!

So yup – I enjoyed SQLPASS!

Cross Posted from: http://beyondrelational.com/blogs/parasdoshi/archive/2011/10/17/sqlpass-2011-was-amazing.aspx