forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDorisCastOperation.java
More file actions
45 lines (36 loc) · 1.07 KB
/
DorisCastOperation.java
File metadata and controls
45 lines (36 loc) · 1.07 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
package sqlancer.doris.ast;
import sqlancer.doris.DorisSchema.DorisCompositeDataType;
import sqlancer.doris.DorisSchema.DorisDataType;
public class DorisCastOperation implements DorisExpression {
DorisExpression expr;
DorisDataType type;
public DorisCastOperation(DorisExpression expr, DorisCompositeDataType type) {
this.expr = expr;
this.type = type.getPrimitiveDataType();
}
public DorisCastOperation(DorisExpression expr, DorisDataType type) {
this.expr = expr;
this.type = type;
}
public DorisExpression getExpr() {
return expr;
}
public DorisExpression getExpression() {
return expr;
}
public DorisDataType getType() {
return type;
}
@Override
public DorisConstant getExpectedValue() {
DorisConstant expectedValue = getExpression().getExpectedValue();
if (expectedValue == null) {
return null;
}
return expectedValue.cast(type);
}
@Override
public DorisDataType getExpectedType() {
return type;
}
}