github-actions[bot] commented on code in PR #63350:
URL: https://github.com/apache/doris/pull/63350#discussion_r3257686241
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/TopNWeighted.java:
##########
@@ -205,4 +206,14 @@ public void checkLegalityBeforeTypeCoercion() {
+ this.toSql());
}
}
+
+ @Override
+ public void checkLegalityAfterRewrite() {
+ Expression topNCount = getArgument(2);
Review Comment:
This check runs after function signature coercion has already narrowed the
count argument to `IntegerType`. For literals, `TypeCoercionUtils.unSafeCast()`
uses `DataType.promoteLiteral(..., IntegerType.INSTANCE)`, which constructs
`new IntegerLiteral(((Number) value).intValue())`. That means the existing
regression query in
`regression-test/suites/nereids_function_p0/type_coercion.groovy` with
`topn_weighted(..., 2147483648)` is converted to `IntegerLiteral(-2147483648)`
before reaching this check, so it now throws this new positive-integer error
instead of producing the current expected `\N`. Please either explicitly reject
out-of-range counts and update that regression coverage/expected result, or
validate the original literal range before the narrowing cast so positive
constants are not misclassified after overflow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]