forked from afterburnerdb/afterburner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
be_demo.html
439 lines (415 loc) · 17.3 KB
/
be_demo.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Afterburner Demo</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.4/pako.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/codemirror.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/codemirror.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/mode/sql/sql.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<a href="https://github.com/lintool/afterburner/"><img style="position: absolute; top: 0; right: 0; border: 0; z-index:9999;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
<style type="text/css">
body {
padding-top: 50px;
}
.table-nonfluid {
width: auto !important;
}
.table-responsive {
overflow: auto;
}
.rowspc{
margin-top:20px;
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Afterburner</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="./index.html">Home</a></li>
<li><a href="./about.html">About</a></li>
<li class="active"><a href="./demo.html">Demo</a></li>
</ul>
</div><!--/.navbar-collapse -->
</div>
</nav>
<div class="container">
<div class="page-header">
<h1>Afterburner: Demo</h1>
<p class="lead">Interactive SQL analytics in your browser!</p>
</div>
<p>In this demo we've prepared a sample data warehouse based on the
<a href="http://www.tpc.org/tpch/">TPC-H</a> schema using scale factor
100 GB on a backend node (MonetDB v11.23.13). For best performance, we
recommend using
<a href="https://www.mozilla.org/en-US/firefox/all/">Firefox (64-bit)</a>
(for <a href="http://asmjs.org/">asm.js</a> support) and running on a
client with at least 4GB memory. Begin by clicking on the "initialize"
button below and select a memory configuration (how much memory on
the client to allocate). Then click the "connect" button below to
connect to the backend and you'll be ready to pick some of the SQL
queries we picked for you. Click "Run Full Query Against Backend" to run
the query on the backend node. Alternatively, you can pick a column to
free (i.e. explore query using an in browser materialized view). We
prepared sliders, menus, etc. for each query so you can explore queries
under different filters.
</p>
<div class="row">
<div class="container">
<div class="dropdown" id="initmenu" style="float:left; margin:0 10px 10px 0;">
<button class="btn dropdown-toggle btn-warning" id="initbtn" type="button" data-toggle="dropdown">
<span class="glyphicon glyphicon-fire" id="initglyph"></span>
Initialize Afterburner!
</button>
<ul class="dropdown-menu">
<li><a>tiny (~0.5 GB)</a></li>
<li><a>small (~0.75 GB)</a></li>
<li><a>medium (~1.5 GB)</a></li>
<li><a>large (~3.0 GB)</a></li>
</ul>
</div>
<button class="btn btn-default btn-file btn-primary" id="connbtn" data-placement="bot" onclick="connBE()"
style="float:left; margin:0 10px 10px 0;">
<span class="glyphicon glyphicon-flash" id="glypconn"></span>
Connect to Backend!
</button>
<label class="btn btn-default btn-file" id="schmbtn" data-placement="bot" onclick="togSchema(this,{'be':true})">
Show Tables
</label>
</div>
</div>
<div class="row rowspc">
<div class="col-md-12">
<div id="sconsole">
</div>
<div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel-group" id="group">
<div id="pnlsql" class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#group" href="#ctlTASQL">
Query
<span class="badge" id="qlabel">?</span>
</a>
</h4>
</div>
<div id="ctlTASQL" class="panel-collapse collapse">
<textarea rows="10" id="TASQL" name="TASQL" type="text" readonly=""
placeholder="Pick a query using Insert TPC-H Query button bellow..">
</textarea>
</div>
</div>
<div id="pnlvsql" class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#group" href="#ctlTAVSQL">
Materialized View Query
<span class="badge" id="vlabel">?</span>
</a>
</h4>
</div>
<div id="ctlTAVSQL" class="panel-collapse collapse">
<textarea rows="10" id="TAVSQL" name="TAVSQL" type="text" readonly=""
placeholder="Free a query using the Free button bellow..">
</textarea>
</div>
</div>
<div id="pnlcsql" class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#group" href="#ctlTACSQL">
Frontend Query
<span class="badge" id="clabel">?</span>
</a>
</h4>
</div>
<div id="ctlTACSQL" class="panel-collapse collapse">
<textarea rows="10" id="TACSQL" name="TACSQL" type="text" readonly=""
placeholder="Free a query using the Free button bellow..">
</textarea>
</div>
</div>
</div>
</div>
</div>
<div class="row">
</div>
<div class="row">
<div class="container">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle disabled" type="button" id="menu1" data-toggle="dropdown" style="float:left; margin:0 10px 10px 0;">Insert TPC-H Query<span class="caret"></span></button>
<ul class="dropdown-menu" role="menu" aria-labelledby="menu1">
<li><a id="query1_fsql">Q1</a></li>
<li><a id="query2_fsql">Q2</a></li>
<li><a id="query3_fsql">Q3</a></li>
<li><a id="query4_fsql">Q4</a></li>
<li><a id="query5_fsql">Q5</a></li>
<li><a id="query6_fsql">Q6</a></li>
<li><a id="query7_fsql">Q7</a></li>
<li><a id="query12_fsql">Q12</a></li>
<li><a id="query14_fsql">Q14</a></li>
<li><a id="query17_fsql">Q17</a></li>
<li><a id="query20_fsql">Q20</a></li>
<li><a id="query21_fsql">Q21</a></li>
</ul>
</div>
<button id="asisbebtn" type="button" onclick="runcode()" class="btn btn-default" data-placement="bot" style="float:left; margin:0 10px 10px 0;">
Run Full Query Against Backend
</button>
<div id="opencons" style="float:left; margin:0 10px 10px 0;">
</div>
</div>
</div>
</div>
</div>
<br>
<div class="row" id="divconsole">
<div class="col-md-12">
<p id="console"></p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p id="dashcons"></p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="divcons" class="table-responsive">
</div>
</div>
</div>
</div> <!-- /container -->
<div id="waitForPT" class="modal fade" style="left" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<div class='col-md-1'>
<button id="modalgate" type="button" onclick="$('#waitForPT').modal('hide');$('#schmbtn').click();" class="btn btn-default" disabled>Dismiss</button>
</div>
</div>
</div>
</div>
</div>
<!-- Afterburner -->
<script src="./src/core/afterburner.js"></script>
<script src="./src/core/store.js"></script>
<script src="./src/core/aSchema.js"></script>
<script src="./src/core/aTable.js"></script>
<script src="./src/core/queryResult.js"></script>
<script src="./src/core/hashIndex.js"></script>
<script src="./src/core/dataSource.js"></script>
<script src="./src/core/common.js"></script>
<script src="./src/core/html5FileParser.js"></script>
<script src="./src/core/urlParser.js"></script>
<script src="./src/frontend/myJS.js"></script>
<script src="./src/frontend/web.js"></script>
<script src="./src/frontend/progressTracker.js"></script>
<! Afterburner BE ->
<script src="./src/core/fsql2sql.js"></script>
<script src="./src/core/monetJSONParser.js"></script>
<script src="./src/proxy/proxyConf.js"></script>
<script src="./src/proxy/proxyClient.js"></script>
<script src="./src/tpch/fsql/q01.js"></script>
<script src="./src/tpch/fsql/q02.js"></script>
<script src="./src/tpch/fsql/q03.js"></script>
<script src="./src/tpch/fsql/q04.js"></script>
<script src="./src/tpch/fsql/q05.js"></script>
<script src="./src/tpch/fsql/q06.js"></script>
<script src="./src/tpch/fsql/q07.js"></script>
<script src="./src/tpch/fsql/q12.js"></script>
<script src="./src/tpch/fsql/q14.js"></script>
<script src="./src/tpch/fsql/q17.js"></script>
<script src="./src/tpch/fsql/q20.js"></script>
<script src="./src/tpch/fsql/q21.js"></script>
<script src="./src/tpch/q1allscen/benchmark_q1allscen.js"></script>
<script src="./src/tpch/q1allscen/mav01a.js"></script>
<script src="./src/tpch/q2allscen/benchmark_q2allscen.js"></script>
<script src="./src/tpch/q2allscen/mav02a.js"></script>
<script src="./src/tpch/q2allscen/mav02b.js"></script>
<script src="./src/tpch/q2allscen/mav02c.js"></script>
<script src="./src/tpch/q3allscen/benchmark_q3allscen.js"></script>
<script src="./src/tpch/q3allscen/mav03a.js"></script>
<script src="./src/tpch/q3allscen/mav03b.js"></script>
<script src="./src/tpch/q3allscen/mav03c.js"></script>
<script src="./src/tpch/q4allscen/benchmark_q4allscen.js"></script>
<script src="./src/tpch/q4allscen/mav04a.js"></script>
<script src="./src/tpch/q5allscen/benchmark_q5allscen.js"></script>
<script src="./src/tpch/q5allscen/mav05a.js"></script>
<script src="./src/tpch/q5allscen/mav05b.js"></script>
<script src="./src/tpch/q6allscen/benchmark_q6allscen.js"></script>
<script src="./src/tpch/q6allscen/mav06a.js"></script>
<script src="./src/tpch/q6allscen/mav06b.js"></script>
<script src="./src/tpch/q6allscen/mav06c.js"></script>
<script src="./src/tpch/q7allscen/benchmark_q7allscen.js"></script>
<script src="./src/tpch/q7allscen/mav07a.js"></script>
<script src="./src/tpch/q12allscen/benchmark_q12allscen.js"></script>
<script src="./src/tpch/q12allscen/mav12a.js"></script>
<script src="./src/tpch/q12allscen/mav12b.js"></script>
<script src="./src/tpch/q14allscen/benchmark_q14allscen.js"></script>
<script src="./src/tpch/q14allscen/mav14a.js"></script>
<script src="./src/tpch/q17allscen/benchmark_q17allscen.js"></script>
<script src="./src/tpch/q17allscen/mav17a.js"></script>
<script src="./src/tpch/q17allscen/mav17b.js"></script>
<script src="./src/tpch/q20allscen/benchmark_q20allscen.js"></script>
<script src="./src/tpch/q20allscen/mav20a.js"></script>
<script src="./src/tpch/q21allscen/benchmark_q21allscen.js"></script>
<script src="./src/tpch/q21allscen/mav21a.js"></script>
<script src="./src/tpch/q21allscen/mav21b.js"></script>
<script src="./src/micro/benchmark_micro.js"></script>
<script src="./src/tpch/benchmark_tpch_split_scenarioC.js"></script>
<script src="./src/frontend/splitDemo.js"></script>
<script>
function myOnLoad(){
abdb = new Afterburner();
FSi = new fsql2sql();
onLoad2();
}
window.onload = function() {
inNode=false;
myOnLoad();
}
function URLList(){
this.list=[];
}
function runcode(){
clearElementsById(["console","dashcons","divcons"]);
var tt0=window.performance.now();
var sqlstr=editorSQL.getDoc().getValue()
htmltable= pci.execSQLHTMLTableN(sqlstr,100);
var tt1=window.performance.now();
var ttot=tt1-tt0;
printtable(htmltable);
document.getElementById("console").innerHTML = "Query running @backend completed in " + (ttot.toFixed(2))+"ms" ;
DEBUG('time to run code:'+ (ttot));
}
function printtable(htmltable){
divcons=document.getElementById("divcons");
clearElement(divcons);
divcons.appendChild(htmltable);
}
$("#initmenu").on("click", "li a", function() {
DEBUG("will store with size:"+$(this).text());
var size=$(this).text().split(" ")[0];
init_store(size);
$("#initbtn").removeClass("btn-warning");
$("#initbtn").addClass("disabled");
$("#initbtn").text("Initialized: "+$(this).text());
});
function connBE(){
DEBUG("connecting to backend");
pci= new proxyClient();
$("#connbtn").removeClass("btn-primary");
$("#connbtn").addClass("disabled");
$("#pnlsql").addClass("panel-primary");
$("#connbtn").text("Connection succesful");
$("#menu1").removeClass("disabled");
}
</script>
<script type="text/javascript">
var q2oName={
'1' :['l_shipdate (2526 rows)'],
'2' :['p_size (50 rows)', 'p_type (150 rows)'],
'3' :['c_mktsegment (5 rows)', 'o_orderdate (2406 rows)'],
'4' :['o_orderdate (2526 rows)'],
'5' :['r_name (5 rows)', 'o_orderdate (2406 rows)'],
'6' :['l_shipdate (2526 rows)', 'l_discount (11 rows)', 'l_quantity (50 rows)'],
'7' :['l_shipdate (2526 rows)'],
'12':['l_shipmode (7 rows)', 'l_receiptdate (2554 rows)'],
'14':['l_shipdate (2526 rows)'],
'17':['p_brand (25 rows)', 'p_container (40 rows)'],
'20':['n_name (25 rows)'],
'21':['o_orderstatus (3 rows)', 'n_name (25 rows)'],
}
function onLoad2(){
window.editorSQL = CodeMirror.fromTextArea(document.getElementById('TASQL'), {
mode: "text/x-sql",
indentWithTabs: true,
smartIndent: true,
lineNumbers: true,
autofocus: true,
readOnly : true
});
window.editorVSQL = CodeMirror.fromTextArea(document.getElementById('TAVSQL'), {
mode: "text/x-sql",
indentWithTabs: true,
smartIndent: true,
lineNumbers: true,
autofocus: true,
readOnly : true
});
window.editorCSQL = CodeMirror.fromTextArea(document.getElementById('TACSQL'), {
mode: "text/x-sql",
indentWithTabs: true,
smartIndent: true,
lineNumbers: true,
autofocus: true,
readOnly : true
});
}
jQuery("[id*='query']")
.click(function(e){
var fsqlOName=e.currentTarget.id;
var queryName=fsqlOName.substring(0,fsqlOName.length-5);
var sqlstr=eval(fsqlOName+"().toSQL()");
var sqlstr=ppSQLstr(sqlstr);
var qnum=queryName.substring(5);
$('#qlabel').text(qnum);
$("#ctlTASQL").collapse('show');
editorSQL.getDoc().setValue("-- "+queryName+"\n"+sqlstr);
$("#ctlTAVSQL").collapse('hide');
$("#ctlTACSQL").collapse('hide');
$("#pnlvsql").removeClass("panel-success");
$("#pnlcsql").removeClass("panel-warning");
$('#vlabel').text("?");
$('#clabel').text("?");
$("#asisbebtn").show();
var htmldd=newHTMLDD('Free Q'+qnum,q2oName[qnum],{'id':'openbtn'});
var opencons=document.getElementById('opencons');
clearElement(opencons);
opencons.appendChild(htmldd);
$("#openbtn").on("click", "li a", function(e) {
var btnlab=$("#openbtn button").text();
var actqnum=btnlab.substring(6);
var scenid=q2oName[qnum].indexOf(e.currentTarget.text);
var colname=e.currentTarget.text.replace(/\s*\(.*\)/,'')
$('#vlabel').text("Query:"+qnum + " Column:"+colname);
$('#clabel').text("Query:"+qnum + " Column:"+colname);
viz_scene(qnum,scenid,colname);
});
clearElementsById(["console","dashcons","divcons"]);
e.preventDefault();
});
$("#asisbebtn").hide();
function viz_scene(qnum,qscen,opencol){
SDi= new splitDemo(qnum,qscen,opencol);
}
</script>
</body>
</html>