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() {