-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo_debug.html
374 lines (350 loc) · 17.3 KB
/
demo_debug.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
<!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>
<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="#"><img style="height:100%;" src="images/afterburner.png" /></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 online demo we've prepared a sample data warehouse based on the <a href="http://www.tpc.org/tpch/">TPC-H</a> schema.
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 load some data and you'll be ready to start issuing SQL queries!</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>
<div class="dropdown" style="float:left; margin:0 10px 10px 0;" >
<button class="btn dropdown-toggle disabled" id="loadwbtn" type="button" data-toggle="dropdown">
Load data!
</button>
<ul class="dropdown-menu">
<li><label class="btn btn-default btn-file" onclick="loadWeb('tiny')"
style="border: none; border-color: transparent;">
Load demo data (35 MB compressed)
</label>
</li>
<li><label class="btn btn-default btn-file" onclick="loadWeb('small')"
style="border: none; border-color: transparent;">
Load demo data (95 MB compressed)
</label>
</li>
<li><label class="btn btn-default btn-file" onclick="loadWeb()"
style="border: none; border-color: transparent;">
Load demo data (136 MB compressed)
</label>
</li>
<li>
<label class="btn btn-default btn-file" id="loaddbtn" data-placement="bot"
style="border: none; border-color: transparent;">
Load tables from local disk
<input type="file" id="fileInput" style="display: none;" multiple>
</label>
</li>
</ul>
</div>
<label class="btn btn-default btn-file" id="schmbtn" data-toggle="tooltip" data-placement="bot" onclick="togSchema(this)" style="float:left; margin:0 10px 10px 0;">
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">
<h2>Fluent SQL
<a href="about.html" class="btn btn-default btn-xs" role="button">
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> What's this?</a>
</h2>
<textarea rows="10" id="TAFluent" name="TAFluent" class="prettyprint form-control animated linenums language-css" placeholder="Enter a Fluent SQL query or select a sample TPC-H query from below..."></textarea>
<div class="row">
</div>
<div class="row">
<div class="container">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" onchange="alert('boom')" 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 role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query1">Q1</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query2">Q2</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query3">Q3</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query4">Q4</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query5">Q5</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query6">Q6</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query7">Q7</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query8">Q8</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query9">Q9</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query10">Q10</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query11">Q11</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query12">Q12</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query13">Q13</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query14">Q14</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query15">Q15</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query16">Q16</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query17">Q17</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query18">Q18</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query19">Q19</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query20">Q20</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query21">Q21</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" id="query22">Q22</a></li>
</ul>
</div>
<button type="button" onclick="runcode()" class="btn btn-default" href="#" data-placement="bot">
Run Query
</button>
<button type="button" onclick="compilecode()" class="btn btn-default" href="#" data-placement="bot">
Compile Query
</button>
<textarea rows="20" id="TAASM" name="TAASM" class="prettyprint form-control animated linenums language-css" placeholder=""></textarea>
<button type="button" onclick="runcompiledcode()" class="btn btn-default" href="#" data-placement="bot">
Run Compiled Query
</button>
</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">
<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>
<!-- TPC-H -->
<script src="./src/tpch/q01.js"></script>
<script src="./src/tpch/q02.js"></script>
<script src="./src/tpch/q03.js"></script>
<script src="./src/tpch/q04.js"></script>
<script src="./src/tpch/q05.js"></script>
<script src="./src/tpch/q06.js"></script>
<script src="./src/tpch/q07.js"></script>
<script src="./src/tpch/q08.js"></script>
<script src="./src/tpch/q09.js"></script>
<script src="./src/tpch/q10.js"></script>
<script src="./src/tpch/q11.js"></script>
<script src="./src/tpch/q12.js"></script>
<script src="./src/tpch/q13.js"></script>
<script src="./src/tpch/q14.js"></script>
<script src="./src/tpch/q15.js"></script>
<script src="./src/tpch/q16.js"></script>
<script src="./src/tpch/q17.js"></script>
<script src="./src/tpch/q18.js"></script>
<script src="./src/tpch/q19.js"></script>
<script src="./src/tpch/q20.js"></script>
<script src="./src/tpch/q21.js"></script>
<script src="./src/tpch/q22.js"></script>
<script src="./src/tpch/answers/ans1.js"></script>
<script src="./src/tpch/answers/ans2.js"></script>
<script src="./src/tpch/answers/ans3.js"></script>
<script src="./src/tpch/answers/ans4.js"></script>
<script src="./src/tpch/answers/ans5.js"></script>
<script src="./src/tpch/answers/ans6.js"></script>
<script src="./src/tpch/answers/ans7.js"></script>
<script src="./src/tpch/answers/ans8.js"></script>
<script src="./src/tpch/answers/ans9.js"></script>
<script src="./src/tpch/answers/ans10.js"></script>
<script src="./src/tpch/answers/ans11.js"></script>
<script src="./src/tpch/answers/ans12.js"></script>
<script src="./src/tpch/answers/ans13.js"></script>
<script src="./src/tpch/answers/ans14.js"></script>
<script src="./src/tpch/answers/ans15.js"></script>
<script src="./src/tpch/answers/ans16.js"></script>
<script src="./src/tpch/answers/ans17.js"></script>
<script src="./src/tpch/answers/ans18.js"></script>
<script src="./src/tpch/answers/ans19.js"></script>
<script src="./src/tpch/answers/ans20.js"></script>
<script src="./src/tpch/answers/ans21.js"></script>
<script src="./src/tpch/answers/ans22.js"></script>
<script src="./src/tpch/benchmark_tpch.js"></script>
<script src="./src/micro/benchmark_micro.js"></script>
<script>
function myOnLoad(){
abdb = new Afterburner();
}
window.onload = function() {
inNode=false;
var fileInput = document.getElementById('fileInput');
fileInput.addEventListener('change', function(e) {
PTi.trackFiles(fileInput.files);
var files = fileInput.files;
var ds= new dataSource(files, function(){newTable= new aTable(ds);},0);
});
myOnLoad();
}
function URLList(){
this.list=[];
}
function loadWeb(size){
var urls= new URLList();
if (size=='tiny'){
urls.list=[
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.05/lineitem.200000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.05/nation.25.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.05/orders.200000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.05/part.200000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.05/partsupp.200000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.05/region.5.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.05/supplier.10000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.05/customer.150000.tbl.gz"];
}else if (size=='small'){
urls.list=[
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.15/lineitem.800000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.15/nation.25.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.15/orders.800000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.15/part.200000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.15/partsupp.800000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.15/region.5.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.15/supplier.10000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.15/customer.150000.tbl.gz"];
}else{
urls.list=[
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.25/lineitem.1319015.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.25/nation.25.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.25/orders.1500000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.25/part.200000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.25/partsupp.800000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.25/region.5.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.25/supplier.10000.tbl.gz",
"https://afterburnerdb.github.io/afterburner-data/TPC-H-sf.25/customer.150000.tbl.gz"];
}
PTi.trackURLs(urls.list);
var ds= new dataSource(urls, function(){newTable= new aTable(ds);});
}
function runcode(){
var codecode=document.getElementById("TAFluent").value;
// document.getElementById("console").innerHTML = "code=" + codecode;
var tt0=window.performance.now();
runMyAdhocCode(codecode);
var tt1=window.performance.now();
var ttot=tt1-tt0;
document.getElementById("console").innerHTML = "Query completed in " + (ttot.toFixed(2))+"ms" ;
console.log('time to run code:'+ (ttot));
}
function compilecode(){
var codecode=document.getElementById("TAFluent").value;
document.getElementById("TAASM").value=eval(codecode);
}
function runcompiledcode(){
var codecode=document.getElementById("TAASM").value;
eval(codecode);
}
function printtable(htmltable){
divcons=document.getElementById("divcons");
clearElement(divcons);
divcons.appendChild(htmltable);
}
$("#initmenu").on("click", "li a", function() {
console.log("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());
$("#loadwbtn").removeClass("disabled");
$("#loadwbtn").addClass("btn-success");
});
</script>
<script type="text/javascript">
jQuery("[id*='query']").click(function(e){
var toeval=e.currentTarget.id+".toString().replace(/;/g,'').replace(/noasm/g,'').replace('\"q_sums\",300','\"q_sums\",200').replace(/}\w*/,'').replace('return','').replace(/function query.*{/,'/*"+e.currentTarget.id+"*/')";
document.getElementById("TAFluent")
.value=eval(toeval)+" .materialize();\nprinttable(res.toHTMLTableN(100))";
e.preventDefault();});
</script>
</body>
</html>