-
Notifications
You must be signed in to change notification settings - Fork 2
/
SJDB.java
41 lines (32 loc) · 922 Bytes
/
SJDB.java
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
/**
*
*/
package sjdb;
import java.io.*;
/**
* @author nmg
*
*/
public class SJDB {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
// read serialised catalogue from file and parse
String catFile = args[0];
Catalogue cat = new Catalogue();
CatalogueParser catParser = new CatalogueParser(catFile, cat);
catParser.parse();
// read stdin, parse, and build canonical query plan
QueryParser queryParser = new QueryParser(cat, new InputStreamReader(System.in));
Operator plan = queryParser.parse();
System.out.println("Query Plan: " + plan.toString());
// create estimator visitor and apply it to canonical plan
Estimator est = new Estimator();
//plan.accept(est);
// create optimised plan
Optimiser opt = new Optimiser(cat);
Operator optPlan = opt.optimise(plan);
System.out.println("Optimised Plan: " + optPlan.toString());
}
}