Skip to content

Commit

Permalink
[cherry-pick][fix](planner)unnecessary cast will be added on children…
Browse files Browse the repository at this point in the history
… in InPredicate (apache#11033) (apache#11036)

Co-authored-by: morrySnow <101034200+morrySnow@users.noreply.github.com>
  • Loading branch information
2 people authored and caiconghui committed Jul 21, 2022
1 parent 7992ae8 commit c3fa2fa
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 c3fa2fa

Please sign in to comment.