From 4af6a06049715530e010385d3889899101d1a6fc Mon Sep 17 00:00:00 2001 From: morrySnow Date: Wed, 7 Aug 2024 13:53:14 +0800 Subject: [PATCH] [fix](Nereids) cast to boolean wrong when constant folding by be not add case because be return wrong answer for this select cast(2.0 as boolean); -- should return 1 not 2 --- .../nereids/rules/expression/rules/FoldConstantRuleOnBE.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnBE.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnBE.java index f9c978e81111e6..d133eac32baddb 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnBE.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnBE.java @@ -348,7 +348,7 @@ public static List getResultExpression(DataType type, PValues resultCon } else if (type.isBooleanType()) { int num = resultContent.getUint32ValueCount(); for (int i = 0; i < num; ++i) { - Literal literal = BooleanLiteral.of(resultContent.getUint32Value(i) == 1); + Literal literal = BooleanLiteral.of(resultContent.getUint32Value(i) != 0); res.add(literal); } } else if (type.isTinyIntType()) {