forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClickHouseOracleFactory.java
More file actions
62 lines (57 loc) · 2.62 KB
/
ClickHouseOracleFactory.java
File metadata and controls
62 lines (57 loc) · 2.62 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
58
59
60
61
62
package sqlancer.clickhouse;
import java.sql.SQLException;
import sqlancer.OracleFactory;
import sqlancer.clickhouse.ClickHouseProvider.ClickHouseGlobalState;
import sqlancer.clickhouse.gen.ClickHouseExpressionGenerator;
import sqlancer.clickhouse.oracle.tlp.ClickHouseTLPAggregateOracle;
import sqlancer.clickhouse.oracle.tlp.ClickHouseTLPDistinctOracle;
import sqlancer.clickhouse.oracle.tlp.ClickHouseTLPGroupByOracle;
import sqlancer.clickhouse.oracle.tlp.ClickHouseTLPHavingOracle;
import sqlancer.common.oracle.NoRECOracle;
import sqlancer.common.oracle.TLPWhereOracle;
import sqlancer.common.oracle.TestOracle;
import sqlancer.common.query.ExpectedErrors;
public enum ClickHouseOracleFactory implements OracleFactory<ClickHouseGlobalState> {
TLPWhere {
@Override
public TestOracle<ClickHouseGlobalState> create(ClickHouseGlobalState globalState) throws SQLException {
ClickHouseExpressionGenerator gen = new ClickHouseExpressionGenerator(globalState);
ExpectedErrors expectedErrors = ExpectedErrors.newErrors()
.with(ClickHouseErrors.getExpectedExpressionErrors()).build();
return new TLPWhereOracle<>(globalState, gen, expectedErrors);
}
},
TLPDistinct {
@Override
public TestOracle<ClickHouseGlobalState> create(ClickHouseGlobalState globalState) throws SQLException {
return new ClickHouseTLPDistinctOracle(globalState);
}
},
TLPGroupBy {
@Override
public TestOracle<ClickHouseGlobalState> create(ClickHouseGlobalState globalState) throws SQLException {
return new ClickHouseTLPGroupByOracle(globalState);
}
},
TLPAggregate {
@Override
public TestOracle<ClickHouseGlobalState> create(ClickHouseGlobalState globalState) throws SQLException {
return new ClickHouseTLPAggregateOracle(globalState);
}
},
TLPHaving {
@Override
public TestOracle<ClickHouseGlobalState> create(ClickHouseGlobalState globalState) throws SQLException {
return new ClickHouseTLPHavingOracle(globalState);
}
},
NoREC {
@Override
public TestOracle<ClickHouseGlobalState> create(ClickHouseGlobalState globalState) throws SQLException {
ClickHouseExpressionGenerator gen = new ClickHouseExpressionGenerator(globalState);
ExpectedErrors errors = ExpectedErrors.newErrors().with(ClickHouseErrors.getExpectedExpressionErrors())
.with("canceling statement due to statement timeout").build();
return new NoRECOracle<>(globalState, gen, errors);
}
}
}