-
Notifications
You must be signed in to change notification settings - Fork 397
Expand file tree
/
Copy pathMySQLAggregate.java
More file actions
55 lines (43 loc) · 1.73 KB
/
MySQLAggregate.java
File metadata and controls
55 lines (43 loc) · 1.73 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
package sqlancer.mysql.ast;
import java.util.List;
public class MySQLAggregate implements MySQLExpression {
public enum MySQLAggregateFunction {
// See https://dev.mysql.com/doc/refman/8.4/en/aggregate-functions.html#function_count.
COUNT("COUNT", null, false), COUNT_DISTINCT("COUNT", "DISTINCT", true),
// See https://dev.mysql.com/doc/refman/8.4/en/aggregate-functions.html#function_sum.
SUM("SUM", null, false), SUM_DISTINCT("SUM", "DISTINCT", false),
// See https://dev.mysql.com/doc/refman/8.4/en/aggregate-functions.html#function_min.
MIN("MIN", null, false), MIN_DISTINCT("MIN", "DISTINCT", false),
// See https://dev.mysql.com/doc/refman/8.4/en/aggregate-functions.html#function_max.
MAX("MAX", null, false), MAX_DISTINCT("MAX", "DISTINCT", false);
private final String name;
private final String option;
private final boolean isVariadic;
MySQLAggregateFunction(String name, String option, boolean isVariadic) {
this.name = name;
this.option = option;
this.isVariadic = isVariadic;
}
public String getName() {
return this.name;
}
public String getOption() {
return option;
}
public boolean isVariadic() {
return this.isVariadic;
}
}
private final List<MySQLExpression> exprs;
private final MySQLAggregateFunction func;
public MySQLAggregate(List<MySQLExpression> exprs, MySQLAggregateFunction func) {
this.exprs = exprs;
this.func = func;
}
public List<MySQLExpression> getExprs() {
return exprs;
}
public MySQLAggregateFunction getFunc() {
return func;
}
}