Skip to content

Commit 3391ac5

Browse files
nokiaMSgithubgxll
authored andcommitted
[fix][runtime] Fix issue about static CAST.
1 parent 3388b35 commit 3391ac5

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

rel/src/main/java/io/dingodb/expr/rel/RelConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ default ExprParser getExprParser() {
3434
}
3535

3636
default ExprCompiler getExprCompiler() {
37-
ExprCompiler ret = ExprCompiler.ADVANCED;
37+
ExprCompiler ret = ExprCompiler.getAdvancedExprCompiler();
3838
ret.setExprContext(ExprContext.INVALID);
3939
ret.setProcessor(new DingoTimeZoneProcessor(ZoneId.systemDefault()));
4040
return ret;

runtime/src/main/java/io/dingodb/expr/runtime/ExprCompiler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public class ExprCompiler extends ExprVisitorBase<Expr, CompileContext> {
5050
public static final ExprCompiler SIMPLE = new ExprCompiler(ExprConfig.SIMPLE);
5151
public static final ExprCompiler ADVANCED = new ExprCompiler(ExprConfig.ADVANCED);
5252

53+
public static ExprCompiler getAdvancedExprCompiler() {
54+
return new ExprCompiler(new ExprConfigImpl());
55+
//return ADVANCED;
56+
}
57+
5358
@Getter
5459
private final ExprConfig config;
5560

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2021 DataCanvas
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.dingodb.expr.runtime;
18+
19+
import io.dingodb.expr.common.timezone.processor.DingoTimeZoneProcessor;
20+
21+
import java.time.ZoneId;
22+
23+
public class ExprConfigImpl implements ExprConfig {
24+
private ExprContext exprContext = ExprContext.INVALID;
25+
private DingoTimeZoneProcessor processor = new DingoTimeZoneProcessor(ZoneId.systemDefault());
26+
27+
@Override
28+
public boolean withSimplification() {
29+
return true;
30+
}
31+
32+
@Override
33+
public boolean withRangeCheck() {
34+
return true;
35+
}
36+
37+
public ExprContext getExprContext() {
38+
return exprContext;
39+
}
40+
41+
public void setExprContext(ExprContext exprContext) {
42+
this.exprContext = exprContext;
43+
}
44+
45+
@Override
46+
public DingoTimeZoneProcessor getProcessor() {
47+
return processor;
48+
}
49+
50+
public void setProcessor(DingoTimeZoneProcessor processor) {
51+
this.processor = processor;
52+
}
53+
}

0 commit comments

Comments
 (0)