-
Notifications
You must be signed in to change notification settings - Fork 397
Expand file tree
/
Copy pathCitusOptions.java
More file actions
66 lines (55 loc) · 2.6 KB
/
CitusOptions.java
File metadata and controls
66 lines (55 loc) · 2.6 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
63
64
65
66
package sqlancer.citus;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.beust.jcommander.Parameter;
import sqlancer.OracleFactory;
import sqlancer.citus.oracle.CitusNoRECOracle;
import sqlancer.citus.oracle.tlp.CitusTLPAggregateOracle;
import sqlancer.citus.oracle.tlp.CitusTLPHavingOracle;
import sqlancer.citus.oracle.tlp.CitusTLPWhereOracle;
import sqlancer.common.oracle.CompositeTestOracle;
import sqlancer.common.oracle.TestOracle;
import sqlancer.postgres.PostgresGlobalState;
import sqlancer.postgres.PostgresOptions;
import sqlancer.postgres.oracle.PostgresPivotedQuerySynthesisOracle;
public class CitusOptions extends PostgresOptions {
@Parameter(names = "--repartition", description = "Specifies whether repartition joins should be allowed", arity = 1)
public boolean repartition = true;
@Parameter(names = "--citusoracle", description = "Specifies which test oracle should be used for Citus extension to PostgreSQL")
public List<CitusOracleFactory> citusOracle = Arrays.asList(CitusOracleFactory.QUERY_PARTITIONING);
public enum CitusOracleFactory implements OracleFactory<PostgresGlobalState> {
NOREC {
@Override
public TestOracle create(PostgresGlobalState globalState) throws SQLException {
CitusGlobalState citusGlobalState = (CitusGlobalState) globalState;
return new CitusNoRECOracle(citusGlobalState);
}
},
PQS {
@Override
public TestOracle create(PostgresGlobalState globalState) throws SQLException {
return new PostgresPivotedQuerySynthesisOracle(globalState);
}
},
HAVING {
@Override
public TestOracle create(PostgresGlobalState globalState) throws SQLException {
CitusGlobalState citusGlobalState = (CitusGlobalState) globalState;
return new CitusTLPHavingOracle(citusGlobalState);
}
},
QUERY_PARTITIONING {
@Override
public TestOracle create(PostgresGlobalState globalState) throws SQLException {
CitusGlobalState citusGlobalState = (CitusGlobalState) globalState;
List<TestOracle> oracles = new ArrayList<>();
oracles.add(new CitusTLPWhereOracle(citusGlobalState));
oracles.add(new CitusTLPHavingOracle(citusGlobalState));
oracles.add(new CitusTLPAggregateOracle(citusGlobalState));
return new CompositeTestOracle(oracles, globalState);
}
};
}
}