From d07adda7d538db5ca21833324ecfe60398a77498 Mon Sep 17 00:00:00 2001 From: morrySnow <101034200+morrySnow@users.noreply.github.com> Date: Wed, 20 Jul 2022 16:00:26 +0800 Subject: [PATCH] [fix](planner)unnecessary cast will be added on children in InPredicate (#11033) --- .../src/main/java/org/apache/doris/analysis/Analyzer.java | 2 +- .../main/java/org/apache/doris/analysis/FunctionCallExpr.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java index 2aeeb24c44e94d..148d1e543a4b59 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java @@ -1897,7 +1897,7 @@ public Type castAllToCompatibleType(List exprs) throws AnalysisException { } // Add implicit casts if necessary. for (int i = 0; i < exprs.size(); ++i) { - if (exprs.get(i).getType() != compatibleType) { + if (!exprs.get(i).getType().equals(compatibleType)) { Expr castExpr = exprs.get(i).castTo(compatibleType); exprs.set(i, castExpr); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java index 83258db7b44600..2721ca258dd77a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java @@ -695,7 +695,7 @@ private void analyzeBuiltinAggFunction(Analyzer analyzer) throws AnalysisExcepti throw new AnalysisException("topn requires second parameter must be a constant Integer Type: " + this.toSql()); } - if (getChild(1).getType() != ScalarType.INT) { + if (!getChild(1).getType().equals(ScalarType.INT)) { Expr e = getChild(1).castTo(ScalarType.INT); setChild(1, e); } @@ -704,7 +704,7 @@ private void analyzeBuiltinAggFunction(Analyzer analyzer) throws AnalysisExcepti throw new AnalysisException("topn requires the third parameter must be a constant Integer Type: " + this.toSql()); } - if (getChild(2).getType() != ScalarType.INT) { + if (!getChild(2).getType().equals(ScalarType.INT)) { Expr e = getChild(2).castTo(ScalarType.INT); setChild(2, e); }