From 419f433d214c2cb6dfe614cf82715b4aa8a8b060 Mon Sep 17 00:00:00 2001 From: morrySnow <101034200+morrySnow@users.noreply.github.com> Date: Fri, 20 Jan 2023 15:08:10 +0800 Subject: [PATCH] [fix](Nereids) topn arg check is not compatible with legacy planner (#16105) --- .../doris/nereids/trees/expressions/functions/agg/TopN.java | 4 ++-- .../main/java/org/apache/doris/nereids/types/DataType.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/TopN.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/TopN.java index 63e71cd108..5c1bf625a9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/TopN.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/TopN.java @@ -77,12 +77,12 @@ public class TopN extends AggregateFunction @Override public void checkLegalityBeforeTypeCoercion() { - if (!getArgument(1).isConstant() || !getArgumentType(1).isIntegerType()) { + if (!getArgument(1).isConstant() || !getArgumentType(1).isIntegerLikeType()) { throw new AnalysisException( "topn requires second parameter must be a constant Integer Type: " + this.toSql()); } if (arity() == 3) { - if (!getArgument(2).isConstant() || !getArgumentType(2).isIntegerType()) { + if (!getArgument(2).isConstant() || !getArgumentType(2).isIntegerLikeType()) { throw new AnalysisException( "topn requires the third parameter must be a constant Integer Type: " + this.toSql()); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DataType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DataType.java index c2fa66638d..44359fca4a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DataType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DataType.java @@ -438,7 +438,7 @@ public abstract class DataType implements AbstractDataType { } public boolean isIntegerLikeType() { - return this instanceof IntegralType; + return this instanceof IntegralType && !(this instanceof LargeIntType); } public boolean isTinyIntType() {