Everything I learned about Spark, I learned while eating candy.
Can you grab the bag...
...open the bag...
...and eat all the brown ones...
...in only 30 seconds?
All the candies in 30 seconds?
Where do we start?
A
B
C
D
E
F
G
H
I
J
K
L
1 2 3 4 5 6 7 8 9...
Let's estimate how much data we have...
And assess who is free to pitch in and help...
Student A gets bag #1... Student B gets bag #2...
Student C gets bag #3...
Student D...
A
B
C
D
E
F
G
H
I
J
K
L
A
B
C
D
E
F
G
H
I
J
K
L
A
B
C
D
E
F
G
H
I
J
K
L
Eliminate the brown pieces of candy...
Pile the rest in the corner
A
B
C
D
E
F
G
H
I
J
K
L
A
B
C
D
E
F
G
H
I
J
K
L
B
C
D
F
G
I
K
L
Student J gets bag #13... Student E gets bag #14...
Student H gets bag #15...
Student J...
A
E
H
J
A
B
C
D
E
F
G
H
I
J
K
L
A
E
H
J
C
B
D
F
G
I
K
L
A
E
H
J
B
C
D
F
G
I
K
L
A
E
H
J
B
C
D
F
G
I
K
L
All done!
A
B
C
D
E
F
G
H
I
J
K
L
Let's try another!
This time, count `em all!
A
B
C
D
E
F
G
H
I
J
K
L
How do we do this?
A
B
C
D
E
F
G
H
I
J
K
L
Student A gets bag #1... Student D gets bag #2...
Student I gets bag #3...
Student J gets bag #4...
A
B
C
D
E
F
G
H
I
J
K
L
A
D
I
J
B
C
E
F
G
H
K
L
A
D
I
J
B
C
E
F
G
H
K
L
A
D
I
J
B
C
E
F
G
H
K
L
J
5
4
5
B
C
E
F
G
H
K
L
A
D
I
5
4
5
Student J is hung...
I cannot continue !!!
What do I do now?
J
B
C
E
F
G
H
K
L
A
D
I
5
4
5
Student K, count bag #4!
J
B
C
E
F
G
H
K
L
A
D
I
5
4
5
I'll settle for the result of student J or student K...
Whomever finishes first.
?
J
B
C
E
F
G
H
K
L
A
D
I
5
4
5
6
Cancel student J...
...and take K's result
!
J
B
C
E
F
G
H
K
L
A
D
I
5
4
5
6
Prepare for the shuffle!
(A, D & I did earlier)
J
B
C
E
F
G
H
K
L
5
4
5
6
A
D
I
OK, Stage #1 is all done!
J
B
C
E
F
G
H
K
L
5
4
5
6
A
D
I
F
Student F, fetch the counts from A, D, I and K
5
4
5
6
A
B
C
D
E
G
H
I
J
K
L
F
5
4
5
6
5
4
5
6
A
B
C
D
E
G
H
I
J
K
L
F
20
5
4
5
6
A
B
C
D
E
G
H
I
J
K
L
F
5
4
5
6
20
20
A
B
C
D
E
G
H
I
J
K
L
F
20
5
4
5
6
A
B
C
D
E
G
H
I
J
K
L
Thanks!
Sort by color name:
Blue, Brown, Green, Orange, Red, Yellow
F
A
B
C
D
E
G
H
I
J
K
L
F
A
B
C
D
E
G
H
I
J
K
L
Prepare for the shuffle!
F
A
B
C
D
E
G
H
I
J
K
L
OK, Stage #1 is all done!
F
A
B
C
D
E
G
H
I
J
K
L
Student E, get the reds
F
A
B
C
D
E
G
H
I
J
K
L
Student K, get the blues
F
A
B
C
D
E
G
H
I
J
K
L
Student C... orange
Student J... green
Student H... brown
Student B... yellow
F
A
B
C
D
E
G
H
I
J
K
L
Collect all the results back to the driver...
F
A
B
C
D
E
G
H
I
J
K
L
F
A
B
C
D
E
G
H
I
J
K
L
Thanks!
5
4
5
6
5
4
5
6
Read data from there, do A, B, C & D to it, when you are all done, write it out over there
5
4
5
6
20
20