-
Notifications
You must be signed in to change notification settings - Fork 0
/
Spark Resilient Distributed Datasets Queries with AWS EC2 Server.htm
699 lines (642 loc) · 25.6 KB
/
Spark Resilient Distributed Datasets Queries with AWS EC2 Server.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft Word 15 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"Century Gothic";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:0in;
margin-right:0in;
margin-bottom:8.0pt;
margin-left:0in;
line-height:107%;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
h1
{mso-style-link:"Heading 1 Char";
margin-top:20.0pt;
margin-right:0in;
margin-bottom:2.0pt;
margin-left:0in;
page-break-after:avoid;
font-size:18.0pt;
font-family:"Century Gothic",sans-serif;
color:#021730;
font-weight:normal;}
h2
{mso-style-link:"Heading 2 Char";
margin-top:2.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
page-break-after:avoid;
font-size:16.0pt;
font-family:"Century Gothic",sans-serif;
color:#032348;
font-weight:normal;}
h3
{mso-style-link:"Heading 3 Char";
margin-top:2.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
page-break-after:avoid;
font-size:14.0pt;
font-family:"Century Gothic",sans-serif;
color:#032348;
font-weight:normal;}
h4
{mso-style-link:"Heading 4 Char";
margin-top:2.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
line-height:107%;
page-break-after:avoid;
font-size:12.0pt;
font-family:"Century Gothic",sans-serif;
color:#032348;
font-weight:normal;}
h5
{mso-style-link:"Heading 5 Char";
margin-top:2.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
line-height:107%;
page-break-after:avoid;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;
color:#032348;
text-transform:uppercase;
font-weight:normal;}
h6
{mso-style-link:"Heading 6 Char";
margin-top:2.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
line-height:107%;
page-break-after:avoid;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;
color:#021730;
text-transform:uppercase;
font-weight:normal;
font-style:italic;}
p.MsoHeading7, li.MsoHeading7, div.MsoHeading7
{mso-style-link:"Heading 7 Char";
margin-top:2.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
line-height:107%;
page-break-after:avoid;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;
color:#021730;
font-weight:bold;}
p.MsoHeading8, li.MsoHeading8, div.MsoHeading8
{mso-style-link:"Heading 8 Char";
margin-top:2.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
line-height:107%;
page-break-after:avoid;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;
color:#021730;
font-weight:bold;
font-style:italic;}
p.MsoHeading9, li.MsoHeading9, div.MsoHeading9
{mso-style-link:"Heading 9 Char";
margin-top:2.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
line-height:107%;
page-break-after:avoid;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;
color:#021730;
font-style:italic;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
{margin-top:0in;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:0in;
line-height:107%;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoToc2, li.MsoToc2, div.MsoToc2
{margin-top:0in;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:11.0pt;
line-height:107%;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoToc3, li.MsoToc3, div.MsoToc3
{margin-top:0in;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:22.0pt;
line-height:107%;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoHeader, li.MsoHeader, div.MsoHeader
{mso-style-link:"Header Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoFooter, li.MsoFooter, div.MsoFooter
{mso-style-link:"Footer Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoCaption, li.MsoCaption, div.MsoCaption
{margin-top:0in;
margin-right:0in;
margin-bottom:8.0pt;
margin-left:0in;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;
font-variant:small-caps;
color:#146194;
font-weight:bold;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
{mso-style-link:"Title Char";
margin:0in;
margin-bottom:.0001pt;
line-height:85%;
font-size:36.0pt;
font-family:"Century Gothic",sans-serif;
color:#146194;
text-transform:uppercase;
letter-spacing:-.75pt;}
p.MsoTitleCxSpFirst, li.MsoTitleCxSpFirst, div.MsoTitleCxSpFirst
{mso-style-link:"Title Char";
margin:0in;
margin-bottom:.0001pt;
line-height:85%;
font-size:36.0pt;
font-family:"Century Gothic",sans-serif;
color:#146194;
text-transform:uppercase;
letter-spacing:-.75pt;}
p.MsoTitleCxSpMiddle, li.MsoTitleCxSpMiddle, div.MsoTitleCxSpMiddle
{mso-style-link:"Title Char";
margin:0in;
margin-bottom:.0001pt;
line-height:85%;
font-size:36.0pt;
font-family:"Century Gothic",sans-serif;
color:#146194;
text-transform:uppercase;
letter-spacing:-.75pt;}
p.MsoTitleCxSpLast, li.MsoTitleCxSpLast, div.MsoTitleCxSpLast
{mso-style-link:"Title Char";
margin:0in;
margin-bottom:.0001pt;
line-height:85%;
font-size:36.0pt;
font-family:"Century Gothic",sans-serif;
color:#146194;
text-transform:uppercase;
letter-spacing:-.75pt;}
p.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle
{mso-style-link:"Subtitle Char";
margin-top:0in;
margin-right:0in;
margin-bottom:12.0pt;
margin-left:0in;
font-size:14.0pt;
font-family:"Century Gothic",sans-serif;
color:#052F61;}
a:link, span.MsoHyperlink
{color:#0D2E46;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:#356A95;
text-decoration:underline;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{margin-top:0in;
margin-right:0in;
margin-bottom:8.0pt;
margin-left:.5in;
line-height:107%;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
{margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:107%;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
{margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:107%;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
{margin-top:0in;
margin-right:0in;
margin-bottom:8.0pt;
margin-left:.5in;
line-height:107%;
font-size:11.0pt;
font-family:"Century Gothic",sans-serif;}
p.MsoQuote, li.MsoQuote, div.MsoQuote
{mso-style-link:"Quote Char";
margin-top:6.0pt;
margin-right:0in;
margin-bottom:6.0pt;
margin-left:.5in;
line-height:107%;
font-size:12.0pt;
font-family:"Century Gothic",sans-serif;
color:#146194;}
p.MsoIntenseQuote, li.MsoIntenseQuote, div.MsoIntenseQuote
{mso-style-link:"Intense Quote Char";
margin-right:0in;
margin-bottom:12.0pt;
margin-left:.5in;
text-align:center;
font-size:16.0pt;
font-family:"Century Gothic",sans-serif;
color:#146194;
letter-spacing:-.3pt;}
span.MsoSubtleEmphasis
{color:#595959;
font-style:italic;}
span.MsoIntenseEmphasis
{font-weight:bold;
font-style:italic;}
span.MsoSubtleReference
{font-variant:small-caps;
color:#595959;
border:none;
text-decoration:none;}
span.MsoIntenseReference
{font-variant:small-caps;
color:#146194;
font-weight:bold;
text-decoration:underline;}
span.MsoBookTitle
{font-variant:small-caps;
letter-spacing:.5pt;
font-weight:bold;}
p.MsoTocHeading, li.MsoTocHeading, div.MsoTocHeading
{margin-top:20.0pt;
margin-right:0in;
margin-bottom:2.0pt;
margin-left:0in;
page-break-after:avoid;
font-size:18.0pt;
font-family:"Century Gothic",sans-serif;
color:#021730;}
span.HeaderChar
{mso-style-name:"Header Char";
mso-style-link:Header;}
span.FooterChar
{mso-style-name:"Footer Char";
mso-style-link:Footer;}
span.cm-keyword
{mso-style-name:cm-keyword;}
span.cm-variable-2
{mso-style-name:cm-variable-2;}
span.cm-number
{mso-style-name:cm-number;}
span.Heading1Char
{mso-style-name:"Heading 1 Char";
mso-style-link:"Heading 1";
font-family:"Century Gothic",sans-serif;
color:#021730;}
span.Heading2Char
{mso-style-name:"Heading 2 Char";
mso-style-link:"Heading 2";
font-family:"Century Gothic",sans-serif;
color:#032348;}
span.Heading3Char
{mso-style-name:"Heading 3 Char";
mso-style-link:"Heading 3";
font-family:"Century Gothic",sans-serif;
color:#032348;}
span.Heading4Char
{mso-style-name:"Heading 4 Char";
mso-style-link:"Heading 4";
font-family:"Century Gothic",sans-serif;
color:#032348;}
span.Heading5Char
{mso-style-name:"Heading 5 Char";
mso-style-link:"Heading 5";
font-family:"Century Gothic",sans-serif;
color:#032348;
text-transform:uppercase;}
span.Heading6Char
{mso-style-name:"Heading 6 Char";
mso-style-link:"Heading 6";
font-family:"Century Gothic",sans-serif;
color:#021730;
text-transform:uppercase;
font-style:italic;}
span.Heading7Char
{mso-style-name:"Heading 7 Char";
mso-style-link:"Heading 7";
font-family:"Century Gothic",sans-serif;
color:#021730;
font-weight:bold;}
span.Heading8Char
{mso-style-name:"Heading 8 Char";
mso-style-link:"Heading 8";
font-family:"Century Gothic",sans-serif;
color:#021730;
font-weight:bold;
font-style:italic;}
span.Heading9Char
{mso-style-name:"Heading 9 Char";
mso-style-link:"Heading 9";
font-family:"Century Gothic",sans-serif;
color:#021730;
font-style:italic;}
span.TitleChar
{mso-style-name:"Title Char";
mso-style-link:Title;
font-family:"Century Gothic",sans-serif;
color:#146194;
text-transform:uppercase;
letter-spacing:-.75pt;}
span.SubtitleChar
{mso-style-name:"Subtitle Char";
mso-style-link:Subtitle;
font-family:"Century Gothic",sans-serif;
color:#052F61;}
span.QuoteChar
{mso-style-name:"Quote Char";
mso-style-link:Quote;
color:#146194;}
span.IntenseQuoteChar
{mso-style-name:"Intense Quote Char";
mso-style-link:"Intense Quote";
font-family:"Century Gothic",sans-serif;
color:#146194;
letter-spacing:-.3pt;}
.MsoChpDefault
{font-family:"Century Gothic",sans-serif;}
.MsoPapDefault
{margin-bottom:8.0pt;
line-height:107%;}
/* Page Definitions */
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
</head>
<body lang=EN-US link="#0D2E46" vlink="#356A95">
<div class=WordSection1>
<p class=MsoTocHeading>By Afsar Ali</p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc525332210"><b>Spark
Resilient Distributed Datasets Queries with AWS EC2 Server</b><span
style='display:none;text-decoration:none'> </span><span
style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc2><span class=MsoHyperlink><a href="#_Toc525332211">(1)<span
style='text-decoration:none'> </span>what is Spark<span style='display:
none;text-decoration:none'>. </span><span
style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc2><span class=MsoHyperlink><a href="#_Toc525332212">(2)<span
style='text-decoration:none'> </span>what is Spark RDD<span
style='display:none;text-decoration:none'>.. </span><span
style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc2><span class=MsoHyperlink><a href="#_Toc525332213">(3)<span
style='text-decoration:none'> </span>what is Spark SQL<span
style='display:none;text-decoration:none'>. </span><span
style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc2><span class=MsoHyperlink><a href="#_Toc525332214">(4)<span
style='text-decoration:none'> </span>Benefits of using Spark SQL<span
style='display:none;text-decoration:none'>. </span><span
style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc2><span class=MsoHyperlink><a href="#_Toc525332215">(5)<span
style='text-decoration:none'> </span>five queries with questions, queries,
and screenshots of Spark Shell.<span style='display:none;text-decoration:none'> </span><span style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc3><span class=MsoHyperlink><a href="#_Toc525332216"><b>Question
1:</b> To translate my marketing content to Europe, I wanted to see all the Non
English speaking places with the Highest Population in Europe?<span
style='display:none;text-decoration:none'>. </span><span
style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc3><span class=MsoHyperlink><a href="#_Toc525332217"><b>Question
2:</b> I wanted to see whats the highest population of In US Cities and its
relationship with Life Exp and GNP?<span style='display:none;text-decoration:
none'>. </span><span
style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc3><span class=MsoHyperlink><a href="#_Toc525332218"><b>Question
3:</b> Whats the top 10 popular cities that has Life Expectancy of at least 70<span
style='display:none;text-decoration:none'>. </span><span
style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc3><span class=MsoHyperlink><a href="#_Toc525332219"><b>Question
4:</b> Which Countries in the Europe Speaks English with Highest Population So
I dont have to translate my Marketing Content?<span style='display:none;
text-decoration:none'>. </span><span
style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoToc3><span class=MsoHyperlink><a href="#_Toc525332220"><b>Question
5:</b> I am looking for my Second HQ. Whats the top 10 popular cities that has
very high Life Expectancy of at least 80 and with lots of land so I can
negotiate a better deal?<span style='display:none;text-decoration:none'>. </span><span style='display:none;text-decoration:none'>1</span></a></span></p>
<p class=MsoNormal> </p>
<h1><a name="_Toc525332210"><b><span style='font-size:14.0pt'>Spark Resilient
Distributed Datasets Queries with AWS EC2 Server</span></b></a> </h1>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> </p>
<p class=MsoListParagraphCxSpFirst style='margin-bottom:0in;margin-bottom:.0001pt;
text-indent:-.25in;line-height:normal'><a name="_Toc525332211">(1)<span
style='font:7.0pt "Times New Roman"'> </span>what is Spark</a> </p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:1.0in;margin-bottom:.0001pt;line-height:normal'>Spark
is an open source processing engine built around speed, ease of use, and
analytics. It can handle large amounts of data that requires low latency
processing that a typical Map-Reduce program cannot provide. Spark can handle
several petabytes of data at a time, distributed across a cluster of thousands
of cooperating physical or virtual servers. It has an extensive set of
developer libraries and APIs and supports languages such as Java, Python, R,
and Scala; its flexibility makes it well-suited for a range of use cases. Spark
is often used alongside Hadoops data storage module.</p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:1.0in;margin-bottom:.0001pt;line-height:normal'> </p>
<p class=MsoListParagraphCxSpMiddle style='margin-bottom:0in;margin-bottom:
.0001pt;text-indent:-.25in;line-height:normal'><a name="_Toc525332212">(2)<span
style='font:7.0pt "Times New Roman"'> </span>what is Spark RDD</a> </p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:1.0in;margin-bottom:.0001pt;line-height:normal'>Resilient
Distributed Datasets (RDD) is a fundamental data structure of Spark. It is an
immutable distributed collection of objects. Each dataset in RDD is divided
into logical partitions, which may be computed on different nodes of the
cluster. RDDs can contain any type of Python, Java, or Scala objects, including
user-defined classes. Spark makes use of the concept of RDD to achieve faster
and efficient MapReduce operations.</p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:1.0in;margin-bottom:.0001pt;line-height:normal'> </p>
<p class=MsoListParagraphCxSpMiddle style='margin-bottom:0in;margin-bottom:
.0001pt;text-indent:-.25in;line-height:normal'><a name="_Toc525332213">(3)<span
style='font:7.0pt "Times New Roman"'> </span>what is Spark SQL</a></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:1.0in;margin-bottom:.0001pt;line-height:normal'>Spark
SQL is Sparks interface for working with structured and semistructured data.
Structured data is considered any data that has a schema such as JSON, Hive
Tables, Parquet. Semistructured data is when there is no separation between
the schema and the data. One use of Spark SQL is to execute SQL queries. Spark
SQL can also be used to read data from an existing Hive installation.</p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:1.0in;margin-bottom:.0001pt;line-height:normal'> </p>
<p class=MsoListParagraphCxSpMiddle style='margin-bottom:0in;margin-bottom:
.0001pt;text-indent:-.25in;line-height:normal'><a name="_Toc525332214">(4)<span
style='font:7.0pt "Times New Roman"'> </span>Benefits of using
Spark SQL</a> </p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:1.0in;margin-bottom:.0001pt;line-height:normal'>Simplicity,
Versatility, Reduce disk I/0, Storage, Multilanguage, Resource manager
independence, Interactive shell (REPL)</p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:1.0in;margin-bottom:.0001pt;line-height:normal'> </p>
<p class=MsoListParagraphCxSpMiddle style='margin-bottom:0in;margin-bottom:
.0001pt;text-indent:-.25in;line-height:normal'><a name="_Toc525332215">(5)<span
style='font:7.0pt "Times New Roman"'> </span>five queries with
questions, queries, and screenshots of Spark Shell.</a></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'> </span></b></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><a
name="_Toc525332216"><b><span style='color:#00B050'>Question 1:</span></b> To
translate my marketing content to Europe, I wanted to see all the Non English
speaking places with the Highest Population in Europe?</a></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Query 1: </span></b><span style='font-size:10.0pt;
font-family:Consolas;color:#A9B7C6'>country_lang = Country.join(CountryLanguage,
CountryLanguage.CountryCode == Country.Code, "left_outer")</span></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><span
style='font-size:10.0pt;font-family:Consolas;color:#A9B7C6'>country_lang.select(Country.Name,Country.Population,CountryLanguage.Language,CountryLanguage.Percentage).where(CountryLanguage.Language
!= "English"). orderBy(Country.Population.desc()).filter(Country.Continent
== 'Europe').show(30)</span></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Screenshot:</span></b></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><img
width=623 height=595 id="Picture 8"
src="Spark%20Resilient%20Distributed%20Datasets%20Queries%20with%20AWS%20EC2%20Server_files/image001.jpg"></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><a
name="_Toc525332217"><b><span style='color:#00B050'>Question 2:</span></b> I
wanted to see whats the highest population of In US Cities and its
relationship with Life Exp and GNP?</a></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Query 2: </span></b><span style='font-size:10.0pt;
font-family:Consolas;color:#A9B7C6'>city_lang.select(City.Name,City.Population,Country.Name,Country.LifeExpectancy,Country.GNP).
where(Country.Name == 'United
States').orderBy(City.Population.desc()).filter(Country.LifeExpectancy >
20).show(10,False)</span></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Screenshot:</span></b></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><img
width=623 height=556 id="Picture 1"
src="Spark%20Resilient%20Distributed%20Datasets%20Queries%20with%20AWS%20EC2%20Server_files/image002.jpg"></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><a
name="_Toc525332218"><b><span style='color:#00B050'>Question 3:</span></b>
Whats the top 10 popular cities that has Life Expectancy of at least 70</a> </p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Query 3: </span></b><span style='font-size:10.0pt;
font-family:Consolas;color:#A9B7C6'>city_lang.select(City.Name,City.Population,Country.Name).where(Country.LifeExpectancy
> 70).orderBy(City.Population.desc()).show(10,False)</span></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Screenshot: </span></b></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><img
width=625 height=602 id="Picture 9"
src="Spark%20Resilient%20Distributed%20Datasets%20Queries%20with%20AWS%20EC2%20Server_files/image003.jpg"></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><a
name="_Toc525332219"><b><span style='color:#00B050'>Question 4:</span></b> Which
Countries in the Europe Speaks English with Highest Population So I dont have
to translate my Marketing Content?</a> </p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Query4: </span></b><span style='font-size:10.0pt;
font-family:Consolas;color:#A9B7C6'>country_lang.select(Country.Name,Country.Population,CountryLanguage.Percentage,CountryLanguage.Language).where(CountryLanguage.Language
== 'English'). orderBy(Country.Population.desc()).filter(Country.Continent ==
'Europe').show(30,False)</span></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Screenshot:</span></b></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><img
width=625 height=593 id="Picture 7"
src="Spark%20Resilient%20Distributed%20Datasets%20Queries%20with%20AWS%20EC2%20Server_files/image004.jpg"></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><a
name="_Toc525332220"><b><span style='color:#00B050'>Question 5:</span></b> I am
looking for my Second HQ. Whats the top 10 popular cities that has very high
Life Expectancy of at least 80 and with lots of land so I can negotiate a
better deal?</a></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Query 5: </span></b><span style='font-size:10.0pt;
font-family:Consolas;color:#A9B7C6'>city_lang.select(City.Name,City.Population,Country.LifeExpectancy,Country.Name,Country.SurfaceArea).where(Country.LifeExpectancy
> 70).orderBy(Country.SurfaceArea.desc()).show(10,False)</span></p>
<p class=MsoListParagraphCxSpMiddle style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><b><span
style='color:#00B050'>Screenshot:</span></b></p>
<p class=MsoListParagraphCxSpLast style='margin-top:0in;margin-right:0in;
margin-bottom:0in;margin-left:.25in;margin-bottom:.0001pt;line-height:normal'><img
width=623 height=593 id="Picture 10"
src="Spark%20Resilient%20Distributed%20Datasets%20Queries%20with%20AWS%20EC2%20Server_files/image005.jpg"></p>
</div>
</body>
</html>