forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDorisSelect.java
More file actions
41 lines (31 loc) · 1.22 KB
/
DorisSelect.java
File metadata and controls
41 lines (31 loc) · 1.22 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
package sqlancer.doris.ast;
import sqlancer.Randomly;
import sqlancer.common.ast.SelectBase;
import sqlancer.common.ast.newast.Node;
public class DorisSelect extends SelectBase<Node<DorisExpression>> implements Node<DorisExpression> {
public enum DorisSelectDistinctType {
ALL, DISTINCT, DISTINCTROW, NULL;
public static DorisSelectDistinctType getRandomWithoutNull() {
DorisSelectDistinctType sft;
do {
sft = Randomly.fromOptions(values());
} while (sft == DorisSelectDistinctType.NULL);
return sft;
}
}
private DorisSelectDistinctType selectDistinctType = DorisSelectDistinctType.ALL;
public void setDistinct(boolean isDistinct) {
if (isDistinct) {
this.selectDistinctType = DorisSelectDistinctType.DISTINCT;
} else {
this.selectDistinctType = DorisSelectDistinctType.ALL;
}
}
public void setDistinct(DorisSelectDistinctType type) {
this.selectDistinctType = type;
}
public boolean isDistinct() {
return this.selectDistinctType == DorisSelectDistinctType.DISTINCT
|| this.selectDistinctType == DorisSelectDistinctType.DISTINCTROW;
}
}