Skip to content

Commit

Permalink
[fix](planner)unnecessary cast will be added on children in InPredica…
Browse files Browse the repository at this point in the history
…te (apache#11033)
  • Loading branch information
morrySnow authored and Doris-Extras committed Jul 20, 2022
1 parent 4993ccf commit ba736fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1763,7 +1763,7 @@ public Type castAllToCompatibleType(List<Expr> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,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);
}
Expand All @@ -599,7 +599,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);
}
Expand Down

0 comments on commit ba736fe

Please sign in to comment.