[fix](Nereids) topn arg check is not compatible with legacy planner (#16105)

This commit is contained in:
morrySnow
2023-01-20 15:08:10 +08:00
committed by GitHub
parent 72df283344
commit 419f433d21
2 changed files with 3 additions and 3 deletions

View File

@ -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());
}

View File

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