Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,12 @@ void analyzePredicate(Expr predicate, Analyzer analyzer) throws AnalysisExceptio
binaryPredicate.setChild(1, binaryPredicate.getChild(1).castTo(binaryPredicate.getChild(0).getType()));
binaryPredicate.analyze(analyzer);

ExprRewriter exprRewriter = new ExprRewriter(FoldConstantsRule.INSTANCE);
binaryPredicate.setChild(1, exprRewriter.rewrite(binaryPredicate.getChild(1), analyzer, null));
Expr rightChild = binaryPredicate.getChild(1);
Expr rewrittenExpr = FoldConstantsRule.INSTANCE.apply(rightChild, analyzer, null);
if (rightChild != rewrittenExpr) {
binaryPredicate.setChild(1, rewrittenExpr);
}

Expr leftExpr = binaryPredicate.getChild(0);
if (!(leftExpr instanceof SlotRef)) {
throw new AnalysisException(
Expand Down
17 changes: 17 additions & 0 deletions regression-test/suites/delete_p0/test_delete.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,21 @@ suite("test_delete") {
qt_check_data7 """ select * from every_type_table order by col_1; """
sql "drop table every_type_table"


sql "drop table if exists test2"
sql """
CREATE TABLE `test2`
(
col_1 int,
col_2 decimalv2(10,3)
)ENGINE=OLAP
duplicate KEY(`col_1`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`col_1`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql "set enable_fold_constant_by_be = true;"
sql "DELETE FROM test2 WHERE col_2 = cast(123.45 as decimalv2(10,3));"
}