[enchancement](delete) fix delete stmt return error with fold on be (#28557)
This commit is contained in:
@ -245,8 +245,12 @@ public class DeleteStmt extends DdlStmt {
|
||||
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(
|
||||
|
||||
@ -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));"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user