[enchancement](delete) fix delete stmt return error with fold on be (#28557)

This commit is contained in:
zhangstar333
2024-01-05 11:27:21 +08:00
committed by GitHub
parent 46ccbebfb0
commit f3bbc7b876
2 changed files with 23 additions and 2 deletions

View File

@ -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(