Difference between revisions of "Windbag MapReduce Application"

From CSE231 Wiki
Jump to navigation Jump to search
(Created page with "=Motivation= A simple Mapper and two simple Collectors reinforce our understanding of how pieces of the MapReduce puzzle can be reused. Further, we will reduce the value type...")
 
Line 26: Line 26:
  
 
WindbagApp
 
WindbagApp
 +
 +
<pre>
 +
          COUNT
 +
===========================
 +
      HAMLET: 27
 +
        KING: 14
 +
    POLONIUS:  7
 +
    HORATIO:  5
 +
    OPHELIA:  2
 +
      GHOST:  2
 +
FIRST PLAYER:  2
 +
    LAERTES:  1
 +
ROSENCRANTZ:  1
 +
  VOLTEMAND:  1
 +
PLAYER KING:  1
 +
  GENTLEMAN:  1
 +
PLAYER QUEEN:  1
 +
      QUEEN:  1
 +
 +
 +
 +
          PORTION
 +
===========================
 +
  VOLTEMAND: 1.000000
 +
  GENTLEMAN: 0.333333
 +
PLAYER KING: 0.250000
 +
FIRST PLAYER: 0.250000
 +
PLAYER QUEEN: 0.200000
 +
      GHOST: 0.142857
 +
        KING: 0.137255
 +
    POLONIUS: 0.081395
 +
      HAMLET: 0.075419
 +
    HORATIO: 0.046729
 +
    OPHELIA: 0.034483
 +
ROSENCRANTZ: 0.022222
 +
    LAERTES: 0.016129
 +
      QUEEN: 0.014493
 +
</pre>

Revision as of 08:07, 7 March 2019

Motivation

A simple Mapper and two simple Collectors reinforce our understanding of how pieces of the MapReduce puzzle can be reused. Further, we will reduce the value type of Boolean to both an Integer and a Double in two different Collectors.

Background

Polonius' Advice To Laertes

Code To Implement

class: WindbagMapper.java Java.png
methods: map
package: mapreduce.apps.windbag.studio
source folder: student/src/main/java

method: public void map(PlayLine item, BiConsumer<PlayRole, Boolean> keyValuePairConsumer) Sequential.svg (sequential implementation only)

class: TrueCountClassicReducer.java Java.png
methods: finisher
package: mapreduce.apps.windbag.studio
source folder: student/src/main/java

method: public Function<List<Boolean>, Integer> finisher() Sequential.svg (sequential implementation only)

Attention niels epting.svg Warning:This class inherits from ClassicReducer. Be sure to have completed that studio first.
class: TruePortionClassicReducer.java Java.png
methods: finisher
package: mapreduce.apps.windbag.studio
source folder: student/src/main/java

method: public Function<List<Boolean>, Double> finisher() Sequential.svg (sequential implementation only)

Attention niels epting.svg Warning:This class inherits from ClassicReducer. Be sure to have completed that studio first.

Testing Your Solution

Correctness

class: WindbagStudioTestSuite.java Junit.png
package: mapreduce
source folder: testing/src/test/java

Output

WindbagApp

           COUNT
===========================
      HAMLET: 27
        KING: 14
    POLONIUS:  7
     HORATIO:  5
     OPHELIA:  2
       GHOST:  2
FIRST PLAYER:  2
     LAERTES:  1
 ROSENCRANTZ:  1
   VOLTEMAND:  1
 PLAYER KING:  1
   GENTLEMAN:  1
PLAYER QUEEN:  1
       QUEEN:  1



          PORTION
===========================
   VOLTEMAND: 1.000000
   GENTLEMAN: 0.333333
 PLAYER KING: 0.250000
FIRST PLAYER: 0.250000
PLAYER QUEEN: 0.200000
       GHOST: 0.142857
        KING: 0.137255
    POLONIUS: 0.081395
      HAMLET: 0.075419
     HORATIO: 0.046729
     OPHELIA: 0.034483
 ROSENCRANTZ: 0.022222
     LAERTES: 0.016129
       QUEEN: 0.014493