-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·819 lines (736 loc) · 29.4 KB
/
index.html
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
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<meta name="author" content="" />
<title>Sparklyr: a Big Data API for R</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="index_files/reveal.js-3.3.0.1/css/reveal.css"/>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; background-color: #303030; color: #cccccc; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; }
td.sourceCode { padding-left: 5px; }
pre, code { color: #cccccc; background-color: #303030; }
code > span.kw { color: #f0dfaf; } /* Keyword */
code > span.dt { color: #dfdfbf; } /* DataType */
code > span.dv { color: #dcdccc; } /* DecVal */
code > span.bn { color: #dca3a3; } /* BaseN */
code > span.fl { color: #c0bed1; } /* Float */
code > span.ch { color: #dca3a3; } /* Char */
code > span.st { color: #cc9393; } /* String */
code > span.co { color: #7f9f7f; } /* Comment */
code > span.ot { color: #efef8f; } /* Other */
code > span.al { color: #ffcfaf; } /* Alert */
code > span.fu { color: #efef8f; } /* Function */
code > span.er { color: #c3bf9f; } /* Error */
code > span.wa { color: #7f9f7f; font-weight: bold; } /* Warning */
code > span.cn { color: #dca3a3; font-weight: bold; } /* Constant */
code > span.sc { color: #dca3a3; } /* SpecialChar */
code > span.vs { color: #cc9393; } /* VerbatimString */
code > span.ss { color: #cc9393; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { } /* Variable */
code > span.cf { color: #f0dfaf; } /* ControlFlow */
code > span.op { color: #f0efd0; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #ffcfaf; font-weight: bold; } /* Preprocessor */
code > span.at { } /* Attribute */
code > span.do { color: #7f9f7f; } /* Documentation */
code > span.an { color: #7f9f7f; font-weight: bold; } /* Annotation */
code > span.cv { color: #7f9f7f; font-weight: bold; } /* CommentVar */
code > span.in { color: #7f9f7f; font-weight: bold; } /* Information */
</style>
<link rel="stylesheet" href="index_files/reveal.js-3.3.0.1/css/theme/league.css" id="theme">
<!-- some tweaks to reveal css -->
<style type="text/css">
.reveal h1 { font-size: 2.0em; }
.reveal h2 { font-size: 1.5em; }
.reveal h3 { font-size: 1.25em; }
.reveal h4 { font-size: 1em; }
.reveal .slides>section,
.reveal .slides>section>section {
padding: 0px 0px;
}
.reveal table {
border-width: 1px;
border-spacing: 2px;
border-style: dotted;
border-color: gray;
border-collapse: collapse;
font-size: 0.7em;
}
.reveal table th {
border-width: 1px;
padding-left: 10px;
padding-right: 25px;
font-weight: bold;
border-style: dotted;
border-color: gray;
}
.reveal table td {
border-width: 1px;
padding-left: 10px;
padding-right: 25px;
border-style: dotted;
border-color: gray;
}
</style>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="css/custom.css"/>
<!-- Printing and PDF exports -->
<script id="paper-css" type="application/dynamic-css">
/* Default Print Stylesheet Template
by Rob Glazebrook of CSSnewbie.com
Last Updated: June 4, 2008
Feel free (nay, compelled) to edit, append, and
manipulate this file as you see fit. */
@media print {
/* SECTION 1: Set default width, margin, float, and
background. This prevents elements from extending
beyond the edge of the printed page, and prevents
unnecessary background images from printing */
html {
background: #fff;
width: auto;
height: auto;
overflow: visible;
}
body {
background: #fff;
font-size: 20pt;
width: auto;
height: auto;
border: 0;
margin: 0 5%;
padding: 0;
overflow: visible;
float: none !important;
}
/* SECTION 2: Remove any elements not needed in print.
This would include navigation, ads, sidebars, etc. */
.nestedarrow,
.controls,
.fork-reveal,
.share-reveal,
.state-background,
.reveal .progress,
.reveal .backgrounds {
display: none !important;
}
/* SECTION 3: Set body font face, size, and color.
Consider using a serif font for readability. */
body, p, td, li, div {
font-size: 20pt!important;
font-family: Georgia, "Times New Roman", Times, serif !important;
color: #000;
}
/* SECTION 4: Set heading font face, sizes, and color.
Differentiate your headings from your body text.
Perhaps use a large sans-serif for distinction. */
h1,h2,h3,h4,h5,h6 {
color: #000!important;
height: auto;
line-height: normal;
font-family: Georgia, "Times New Roman", Times, serif !important;
text-shadow: 0 0 0 #000 !important;
text-align: left;
letter-spacing: normal;
}
/* Need to reduce the size of the fonts for printing */
h1 { font-size: 28pt !important; }
h2 { font-size: 24pt !important; }
h3 { font-size: 22pt !important; }
h4 { font-size: 22pt !important; font-variant: small-caps; }
h5 { font-size: 21pt !important; }
h6 { font-size: 20pt !important; font-style: italic; }
/* SECTION 5: Make hyperlinks more usable.
Ensure links are underlined, and consider appending
the URL to the end of the link for usability. */
a:link,
a:visited {
color: #000 !important;
font-weight: bold;
text-decoration: underline;
}
/*
.reveal a:link:after,
.reveal a:visited:after {
content: " (" attr(href) ") ";
color: #222 !important;
font-size: 90%;
}
*/
/* SECTION 6: more reveal.js specific additions by @skypanther */
ul, ol, div, p {
visibility: visible;
position: static;
width: auto;
height: auto;
display: block;
overflow: visible;
margin: 0;
text-align: left !important;
}
.reveal pre,
.reveal table {
margin-left: 0;
margin-right: 0;
}
.reveal pre code {
padding: 20px;
border: 1px solid #ddd;
}
.reveal blockquote {
margin: 20px 0;
}
.reveal .slides {
position: static !important;
width: auto !important;
height: auto !important;
left: 0 !important;
top: 0 !important;
margin-left: 0 !important;
margin-top: 0 !important;
padding: 0 !important;
zoom: 1 !important;
overflow: visible !important;
display: block !important;
text-align: left !important;
-webkit-perspective: none;
-moz-perspective: none;
-ms-perspective: none;
perspective: none;
-webkit-perspective-origin: 50% 50%;
-moz-perspective-origin: 50% 50%;
-ms-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.reveal .slides section {
visibility: visible !important;
position: static !important;
width: auto !important;
height: auto !important;
display: block !important;
overflow: visible !important;
left: 0 !important;
top: 0 !important;
margin-left: 0 !important;
margin-top: 0 !important;
padding: 60px 20px !important;
z-index: auto !important;
opacity: 1 !important;
page-break-after: always !important;
-webkit-transform-style: flat !important;
-moz-transform-style: flat !important;
-ms-transform-style: flat !important;
transform-style: flat !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
transform: none !important;
-webkit-transition: none !important;
-moz-transition: none !important;
-ms-transition: none !important;
transition: none !important;
}
.reveal .slides section.stack {
padding: 0 !important;
}
.reveal section:last-of-type {
page-break-after: avoid !important;
}
.reveal section .fragment {
opacity: 1 !important;
visibility: visible !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
transform: none !important;
}
.reveal section img {
display: block;
margin: 15px 0px;
background: rgba(255,255,255,1);
border: 1px solid #666;
box-shadow: none;
}
.reveal section small {
font-size: 0.8em;
}
}
</script>
<script id="pdf-css" type="application/dynamic-css">
/**
* This stylesheet is used to print reveal.js
* presentations to PDF.
*
* https://github.com/hakimel/reveal.js#pdf-export
*/
* {
-webkit-print-color-adjust: exact;
}
body {
margin: 0 auto !important;
border: 0;
padding: 0;
float: none !important;
overflow: visible;
}
html {
width: 100%;
height: 100%;
overflow: visible;
}
/* Remove any elements not needed in print. */
.nestedarrow,
.reveal .controls,
.reveal .progress,
.reveal .playback,
.reveal.overview,
.fork-reveal,
.share-reveal,
.state-background {
display: none !important;
}
h1, h2, h3, h4, h5, h6 {
text-shadow: 0 0 0 #000 !important;
}
.reveal pre code {
overflow: hidden !important;
font-family: Courier, 'Courier New', monospace !important;
}
ul, ol, div, p {
visibility: visible;
position: static;
width: auto;
height: auto;
display: block;
overflow: visible;
margin: auto;
}
.reveal {
width: auto !important;
height: auto !important;
overflow: hidden !important;
}
.reveal .slides {
position: static;
width: 100%;
height: auto;
left: auto;
top: auto;
margin: 0 !important;
padding: 0 !important;
overflow: visible;
display: block;
-webkit-perspective: none;
-moz-perspective: none;
-ms-perspective: none;
perspective: none;
-webkit-perspective-origin: 50% 50%; /* there isn't a none/auto value but 50-50 is the default */
-moz-perspective-origin: 50% 50%;
-ms-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.reveal .slides section {
page-break-after: always !important;
visibility: visible !important;
position: relative !important;
display: block !important;
position: relative !important;
margin: 0 !important;
padding: 0 !important;
box-sizing: border-box !important;
min-height: 1px;
opacity: 1 !important;
-webkit-transform-style: flat !important;
-moz-transform-style: flat !important;
-ms-transform-style: flat !important;
transform-style: flat !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
transform: none !important;
}
.reveal section.stack {
margin: 0 !important;
padding: 0 !important;
page-break-after: avoid !important;
height: auto !important;
min-height: auto !important;
}
.reveal img {
box-shadow: none;
}
.reveal .roll {
overflow: visible;
line-height: 1em;
}
/* Slide backgrounds are placed inside of their slide when exporting to PDF */
.reveal section .slide-background {
display: block !important;
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: -1;
}
/* All elements should be above the slide-background */
.reveal section>* {
position: relative;
z-index: 1;
}
/* Display slide speaker notes when 'showNotes' is enabled */
.reveal .speaker-notes-pdf {
display: block;
width: 100%;
max-height: none;
left: auto;
top: auto;
z-index: 100;
}
/* Display slide numbers when 'slideNumber' is enabled */
.reveal .slide-number-pdf {
display: block;
position: absolute;
font-size: 14px;
}
</script>
<script>
var style = document.createElement( 'style' );
style.type = 'text/css';
var style_script_id = window.location.search.match( /print-pdf/gi ) ? 'pdf-css' : 'paper-css';
var style_script = document.getElementById(style_script_id).text;
style.innerHTML = style_script;
document.getElementsByTagName('head')[0].appendChild(style);
</script>
</head>
<body>
<!DOCTYPE html>
<html>
<div class="bottombar">
<h1 class="title"></h1><image class="logo" src="./imaxes/rlogo.png" style="position: absolute;right:48px;top:15px; width:100px; height:85px;">
</div>
</html>
<div class="reveal">
<div class="slides">
<section>
<h1 class="title">Sparklyr: a Big Data API for R</h1>
<h3 class="date">16 July, 2019</h3>
</section>
<section id="slides-100" class="slide level2">
<h2>Slides <span class="fa fa-cloud-download" style="color:white;"></span> 100%</h2>
<p><span class="h2-mod"><a href="https://aurora-mareviv.github.io/sparklyr_test">i.gal/mFA0F</a></span></p>
</section>
<section><section id="background" class="titleslide slide level1"><h1>Background <span class="fa fa-compass" style="color:white;"></span></h1></section><section id="what-is-sparklyr" class="slide level2">
<h2>What is <a href="https://spark.rstudio.com/">sparklyr</a>?</h2>
<ul>
<li><p>Exposes the Spark API (written in Scala language) from R.</p></li>
<li><p>Spark allows access to the Hadoop ecosystem.</p></li>
<li><p>Simply, using <span style="color:#fffff;font-family:monospace;"> dplyr</span> syntax!.</p></li>
<li><p>Created by the Rstudio team in 2016.</p></li>
</ul>
<div class="img-center">
<p><img class="plain" style="width:185px;" src="./imaxes/dplyr.png"> <img class="plain" style="width:185px;" src="./imaxes/magrittr.png"> <img class="plain" style="width:185px;" src="./imaxes/sparklyr.png"></p>
</div>
</section><section id="what-is-big-data" class="slide level2">
<h2>What is ‘<a href="https://wiki.apache.org/hadoop/">Big Data</a>’?</h2>
<ul>
<li><p>Reading and writing data at a <em>very big scale</em>!</p></li>
<li><p>by:</p>
<ul>
<li>Volume (Gb, Tb).</li>
<li>Variety / Complexity.</li>
<li>Velocity (streaming).</li>
</ul></li>
</ul>
<div class="img-center">
<p><img class="plain" style="width:500px;" src="./imaxes/hadoop.png"></p>
</div>
</section><section id="what-is-big-data-1" class="slide level2">
<h2>What is ‘<a href="https://wiki.apache.org/hadoop/">Big Data</a>’?</h2>
<div class="img-center">
<p><img class="plain" style="width:900px;" src="./imaxes/bigdata2a.png"></p>
</div>
</section><section id="big-data-and-sparklyr" class="slide level2">
<h2>Big Data and Sparklyr</h2>
<div class="img-center">
<p><img class="plain" style="width:600px;" src="./imaxes/sparklyrstack.png"></p>
</div>
</section><section id="how-is-data-proccessed-hdfs" class="slide level2">
<h2>How is data proccessed?: <span style="color:#a7c2f1">HDFS</span></h2>
<blockquote>
<p>“hadoop distributed filesystem”</p>
</blockquote>
<ul>
<li><p>Different to NTFS, FAT, Ext3…</p></li>
<li><p>Optimized for files bigger than >100 Mb.</p></li>
<li><span style="color:#a7c2f1">r/w</span> format written in Java.
<ul>
<li><em>Parallel</em> writing.<br />
</li>
<li><em>Parallel</em> <strong>and</strong> <em>sequential</em> reading.</li>
</ul></li>
</ul>
<blockquote>
<p>“sequential file reading… but, how?”</p>
</blockquote>
</section><section id="section" class="slide level2">
<h2></h2>
<div class="img-center">
<p><img style="width:900px;" src="./imaxes/hdfs-demo.png"></p>
</div>
</section><section id="rdds" class="slide level2">
<h2>RDD’s</h2>
<blockquote>
<p>Resilient Distributed Database.</p>
</blockquote>
<ul>
<li><p>Basic file format for HDFS.</p></li>
<li><p>Composed by blocks, duplicated in several nodes.</p></li>
<li><p>They are recoverable in case any node is lost.</p></li>
<li><p>They form the basis of the <em>dataframes</em> that <span style="color:#fffff;font-family:monospace;"> sparklyr</span> will use.</p></li>
</ul>
<div class="img-center">
<p><img class="plain" style="width:450px;" src="./imaxes/rdd2.png"></p>
</div>
</section><section id="hdfs-architecture" class="slide level2">
<h2>HDFS Architecture</h2>
<ul>
<li><p>Blocks of 128 Mb.</p></li>
<li><p>Replicated 3 times (by default) in different nodes.</p></li>
<li><p><span style="color:#a7c2f1">NameNode</span> is the directory and metadata tree:</p>
<ul>
<li>Indexes and maps/locates blocks and files.</li>
</ul></li>
</ul>
</section></section>
<section><section id="how-does-spark-work" class="titleslide slide level1"><h1>How does Spark work? <span class="fa fa-magic" style="color:white;"></span></h1></section><section id="how-does-spark-work-1" class="slide level2">
<h2>How does Spark work?</h2>
<h3 id="compute-centric">Compute-centric</h3>
<blockquote>
<p>Data goes where the data-processing software is located (MSExcel).</p>
</blockquote>
<h3 id="data-centric">Data-centric</h3>
<blockquote>
<p><span style="color:#ffbf80;"> Big-Data paradigm: data-processing programs go where data <em>is</em> located (Spark).</span></p>
</blockquote>
</section><section id="how-does-spark-work-2" class="slide level2">
<h2>How does Spark work?</h2>
<div class="img-center">
<p><img class="plain" style="width:150px;" src="./imaxes/pc.png"> <img style="width:700px;" src="./imaxes/spark-comp.png"></p>
</div>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Spark context: local (for 'low memory' tasks only!)</span>
sc <-<span class="st"> </span><span class="kw">spark_connect</span>(<span class="dt">master =</span> <span class="st">"local"</span>,
<span class="dt">spark_home =</span> <span class="st">"/usr/hdp/2.4.2.0-258/spark"</span>)
<span class="co"># Spark context: yarn (for loading bigger datasets)</span>
sc <-<span class="st"> </span><span class="kw">spark_connect</span>(<span class="dt">master =</span> <span class="st">"yarn-client"</span>,
<span class="dt">spark_home =</span> <span class="st">"/usr/hdp/2.4.2.0-258/spark"</span>)</code></pre></div>
</section><section id="how-does-spark-work-3" class="slide level2">
<h2>How does Spark work?</h2>
<ul>
<li><p>From the CESGA console we can access two different filesystems: <!--acceder a dos sistemas de almacenamiento de ficheros: --></p>
<ul>
<li><span style="color:#a7c2f1; font-family:monospace;"> $HOME</span>: NFS Remote filesystem (UNIX-like).</li>
<li><span style="color:#ffbf80; font-family:monospace;"> $HOME</span>: Parallel, remote filesystem, designed for MapReduce applications: HDFS.</li>
</ul></li>
<li><p>Driver: there resides the program that connects with Spark. Translates <span style="color:#fffff;font-family:monospace;"> sparklyr</span> into Spark.</p></li>
<li><p>Master: launches the operations (local, client, cluster).</p></li>
<li><p>YARN manages the resources asked for by Spark.</p></li>
<li><p>Executors implement file operations.</p></li>
</ul>
</section></section>
<section><section id="file-operations-in-spark" class="titleslide slide level1"><h1>File operations in Spark <span class="fa fa-cogs" style="color:white;"></span></h1></section><section id="map-reduce" class="slide level2" data-transition="fade-out">
<h2>Map-Reduce</h2>
<ul>
<li><p>Concept introduced by Google in <a href="https://research.google.com/archive/mapreduce.html">2004</a>.</p></li>
<li><p>Implemented in Apache-Hadoop.</p></li>
<li><p><span style="color:#a7c2f1">Map</span></p></li>
<li><p><span style="color:#a7c2f1">Reduce</span></p></li>
</ul>
</section><section id="map-reduce-1" class="slide level2" data-transition="fade-in slide-out">
<h2>Map-Reduce</h2>
<ul>
<li><p>Concept introduced by Google in <a href="https://research.google.com/archive/mapreduce.html">2004</a>.</p></li>
<li><p>Implemented in Apache-Hadoop.</p></li>
<li><p><span style="color:#ffbf80; font-family:monospace;"> apply()</span></p></li>
<li><p><span style="color:#ffbf80; font-family:monospace;"> summarise()</span></p></li>
</ul>
</section><section id="relevant-operations" class="slide level2">
<h2>Relevant Operations</h2>
<ul>
<li><p>Map – <span style="color:#ffbf80; font-family:monospace;"> apply()</span></p></li>
<li><p>Filter – <span style="color:#ffbf80; font-family:monospace;"> filter() group_by()</span></p></li>
<li><p>Reduce – <span style="color:#ffbf80; font-family:monospace;"> count() summarise()</span></p></li>
<li><p>Collect – <span style="color:#ffbf80; font-family:monospace;"> collect()</span></p></li>
</ul>
<p><span style="color:#ffbf80; font-family:monospace;"> collect</span> triggers the execution of all the previously declared operations, and downloads resulting data to <span style="color:#a7c2f1; font-family:monospace;"> $HOME</span> NFS.</p>
<blockquote>
<p>Spark = ‘Lazy evaluation’.</p>
</blockquote>
</section><section id="examples" class="slide level2">
<h2>Examples</h2>
<p>Municipality data</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">compostela <span class="op">%>%</span>
<span class="st"> </span><span class="kw">filter</span>(area_services <span class="op">></span><span class="st"> </span>area_built <span class="op">*</span><span class="st"> </span><span class="fl">0.5</span>) <span class="op">%>%</span><span class="st"> </span>
<span class="st"> </span>
<span class="st"> </span><span class="kw">head</span>(<span class="dv">6</span>) <span class="op">%>%</span><span class="st"> </span>
<span class="st"> </span><span class="kw">collect</span>()</code></pre></div>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">compostela <span class="op">%>%</span>
<span class="st"> </span><span class="kw">group_by</span>(district, boulevard) <span class="op">%>%</span>
<span class="st"> </span><span class="kw">summarise</span>(<span class="dt">max_num_habitants =</span> <span class="kw">max</span>(num_habitants),
<span class="dt">mean_num_estates =</span> <span class="kw">mean</span>(num_estates),
<span class="dt">total_num_houses =</span> <span class="kw">sum</span>(num_houses)) <span class="op">%>%</span><span class="st"> </span>
<span class="st"> </span>
<span class="st"> </span><span class="kw">head</span>(<span class="dv">4</span>) <span class="op">%>%</span><span class="st"> </span>
<span class="st"> </span><span class="kw">collect</span>()</code></pre></div>
</section><section id="examples-1" class="slide level2">
<h2>Examples</h2>
<p>Book reviews in Amazon</p>
<div class="img-center">
<p><img style="width:550px;" src="./imaxes/mapreduceRamazon.jpg"></p>
</div>
</section><section id="machine-learning-and-regression-models" class="slide level2">
<h2>Machine-learning and Regression models</h2>
<div class="img-center">
<p><img style="width:750px;" src="./imaxes/sparkstack.png"></p>
</div>
</section><section id="and-much-more" class="slide level2">
<h2>And much more</h2>
<ul>
<li><p><span class="fa fa-github-alt" style="color:white;"></span> Github: <span style="color:#ffbf80"><a href="https://github.com/aurora-mareviv">github.com/aurora-mareviv</a></span></p></li>
<li><p><span class="fa fa-code-fork" style="color:white;"></span> Sparklyr tutorial at CESGA: <a href="https://github.com/aurora-mareviv/sparklyr_start">/sparklyr_start</a></p></li>
<li><p><span class="fa fa-globe" style="color:white;"></span> Web UI CESGA: <a href="http://hadoop.cesga.es/">hadoop.cesga.es</a></p></li>
</ul>
</section><section id="section-1" class="slide level2">
<h2></h2>
<h3 id="authors"><span class="alert alert-info" style="color:#fffff;font-family:monospace;">AUTHORS</span></h3>
<ul>
<li><p>Aurora Baluja (<a href="https://xxisantiago.sergas.es/">CHUS</a>)</p>
<ul>
<li><span class="fa fa-github" style="color:white;"></span> <a href="https://github.com/aurora-mareviv"><code>@aurora-mareviv</code></a> <span class="fa fa-twitter" style="color:white;"></span> <a href="https://twitter.com/maureviv"><code>@maureviv</code></a></li>
</ul></li>
<li><p>Javier López Cacheiro (<a href="www.cesga.es">CESGA</a>)</p>
<ul>
<li><span class="fa fa-github" style="color:white;"> </span> <span class="fa fa-twitter" style="color:white;"></span> <a href="https://github.com/javicacheiro"><code>@javicacheiro</code></a></li>
</ul></li>
</ul>
<p><br></p>
<h3 id="acknowledgements"><span class="alert alert-info" style="color:#fffff;font-family:monospace;">ACKNOWLEDGEMENTS</span></h3>
<ul>
<li><p>Carlos Gil Bellosta (<a href="https://www.datanalytics.com/">datanalytics.com</a>) <span class="fa fa-twitter" style="color:white;"></span> <a href="https://twitter.com/gilbellosta"><code>@gilbellosta</code></a></p></li>
<li><p>Comunidad de Usuarios de R de Galicia.</p></li>
</ul>
</section><section id="stickers" class="slide level2">
<h2><span class="alert alert-info" style="color:#fffff;font-family:monospace;">Stickers!</span></h2>
<div class="img-center">
<p><img class="plain" style="width:400px;" src="./imaxes/hex-logo-sin-borde.png"></p>
</div>
</section></section>
<section><section id="sparklyr-tutorial" class="titleslide slide level1"><h1>Sparklyr Tutorial <span class="fa fa-book" style="color:white;"></span></h1></section><section id="sparklyr-tutorial-1" class="slide level2">
<h2>Sparklyr tutorial</h2>
<h3 id="jupyter-notebooks">Jupyter Notebooks</h3>
<ul>
<li><p><a href="./sparklyr_test.ipynb"><code>sparklyr_test</code></a></p>
<ul>
<li>Jupyter notebook for interactive data exploration & modelling.</li>
</ul></li>
<li><p><a href="./sparklyr_test2.ipynb"><code>sparklyr_test2</code></a></p>
<ul>
<li><p>Another Jupyter notebook for interactive data exploration & modelling with a -much- bigger dataset.</p></li>
<li><p>Visualize it in <a href="http://nbviewer.jupyter.org/github/aurora-mareviv/sparklyr_test/blob/master/sparklyr_test2.ipynb#Returning-to-sparklyr">nbviewer.jupyter.org</a></p></li>
</ul></li>
</ul>
</section><section id="sparklyr-tutorial-2" class="slide level2">
<h2>Sparklyr tutorial</h2>
<h3 id="r-script">R script</h3>
<ul>
<li><p><a href="./sparklyr_script.R"><code>sparklyr_script</code></a></p>
<ul>
<li>A <span style="color:#fffff;font-family:monospace;"> .R</span> script that launches as an application.</li>
</ul></li>
</ul>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="ex">spark-submit</span> --deploy-mode client sparklyr_script.R</code></pre></div>
<p><br></p>
<h3 id="clone-this-repo">Clone this repo</h3>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="fu">git</span> clone https://github.com/aurora-mareviv/sparklyr_test
<span class="fu">git</span> clone https://github.com/aurora-mareviv/sparklyr_start</code></pre></div>
</section><section id="references" class="slide level2">
<h2>References</h2>
<ul>
<li><a href="https://github.com/aurora-mareviv/sparklyr_start" target="_blank"><code>sparklyr</code> workshop</a></li>
<li><a href="http://spark.rstudio.com/" target="_blank"><code>sparklyr</code> tutorial</a>.</li>
<li><a href="https://www.rstudio.com/resources/cheatsheets/#sparklyr" target="_blank"><code>sparklyr</code> cheatsheet</a>.</li>
<li><a href="http://spark.rstudio.com/extensions.html" target="_blank"><code>sparklyr</code>: creating extensions</a>.</li>
<li><a href="https://stackoverflow.com/questions/39494484/sparkr-vs-sparklyr" target="_blank">Differences between <code>sparkr</code> and <code>sparklyr</code></a>.</li>
<li><a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF" target="_blank">Hive Operators and UDFs</a>.</li>
<li><a href="http://www.folkstalk.com/2011/11/string-functions-in-hive.html" target="_blank">String Functions in Hive</a>.</li>
<li><a href="https://www.postgresql.org/docs/9.4/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP" target="_blank">POSIX regular expressions</a>.</li>
<li><a href="https://github.com/javicacheiro/pyspark_course" target="_blank">PySpark course</a></li>
<li><a href="https://spark.apache.org/docs/0.9.0/python-programming-guide.html" target="_blank">PySpark Programming Guide</a>.</li>
<li><a href="https://s3.amazonaws.com/assets.datacamp.com/blog_assets/PySpark_SQL_Cheat_Sheet_Python.pdf" target="_blank">PySpark cheatsheet</a>.</li>
<li><a href="https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/" target="_blank">Jupyter shortcuts</a></li>
</ul>
<!-- - [`sparklyr` presentation](https://cdn.oreillystatic.com/en/assets/1/event/193/Sparklyr_%20An%20R%20interface%20for%20Apache%20Spark%20Presentation.pdf) -->
<!--
<div class="img-center">
<img style="width:800px;" src="./imaxes/dag2.png">
</div>
-->
</section></section>
</div>
</div>
<script src="index_files/reveal.js-3.3.0.1/lib/js/head.min.js"></script>
<script src="index_files/reveal.js-3.3.0.1/js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
// Display the page number of the current slide
slideNumber: false,
// Push each slide change to the browser history
history: true,
// Vertical centering of slides
center: true,
// Enables touch navigation on devices with touch input
touch: true,
// Opens links in an iframe preview overlay
previewLinks: true,
// Transition style
transition: 'default', // none/fade/slide/convex/concave/zoom
// Transition style for full page slide backgrounds
backgroundTransition: 'default', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'index_files/reveal.js-3.3.0.1/plugin/notes/notes.js', async: true },
]
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "TRUE";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
<script>
(function() {
if (window.jQuery) {
Reveal.addEventListener( 'slidechanged', function(event) {
window.jQuery(event.previousSlide).trigger('hidden');
window.jQuery(event.currentSlide).trigger('shown');
});
}
})();
</script>
</body>
</html>