forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFelderaGlobalState.java
More file actions
57 lines (47 loc) · 1.52 KB
/
FelderaGlobalState.java
File metadata and controls
57 lines (47 loc) · 1.52 KB
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
package sqlancer.feldera;
import sqlancer.ExecutionTimer;
import sqlancer.GlobalState;
import sqlancer.common.query.Query;
import java.util.ArrayList;
import java.util.List;
public class FelderaGlobalState extends GlobalState<FelderaOptions, FelderaSchema, FelderaConnection> {
List<String> views = new ArrayList<>();
@Override
protected void executeEpilogue(Query<?> q, boolean success, ExecutionTimer timer) throws Exception {
boolean logExecutionTime = getOptions().logExecutionTime();
if (success && getOptions().printSucceedingStatements()) {
System.out.println(q.getQueryString());
}
if (logExecutionTime) {
getLogger().writeCurrent(" -- " + timer.end().asString());
}
if (q.couldAffectSchema()) {
updateSchema();
}
}
@Override
public void updateSchema() {
; // do nothing
}
@Override
public FelderaSchema getSchema() {
return super.getSchema();
}
@Override
protected FelderaSchema readSchema() throws Exception {
return FelderaSchema.fromConnection(getConnection());
}
public void addTable(FelderaSchema.FelderaTable table) {
FelderaSchema sch = getSchema();
if (sch == null) {
sch = new FelderaSchema(getConnection().getPipelineName());
}
setSchema(sch.addTable(table));
}
public void addView(String view) {
this.views.add(view);
}
public List<String> getViews() {
return this.views;
}
}