HappenLee opened a new pull request, #68254: URL: https://github.com/apache/doris/pull/68254
### What problem does this PR solve? Issue Number: None Related PR: None Problem Summary: FE advertises three- and four-argument `TOPN_WEIGHTED` signatures with a BOOLEAN value argument, but BE does not implement that value type. For example, `SELECT topn_weighted(TRUE, 1, 1)` passes analysis and then fails with `Agg Function topn_weighted(boolean, bigint, int) is not implemented` during backend initialization. Remove both BOOLEAN signatures and reject BOOLEAN value arguments in `checkLegalityBeforeTypeCoercion()`. Removing the signatures alone is insufficient: an analyzer probe showed that `topn_weighted(TRUE, 1, 1)` is then implicitly rewritten to a DOUBLE value argument with an ARRAY<DOUBLE> result. The explicit legality check prevents that fallback and reports a clear analysis error for both overloads. Explicit numeric casts, such as `topn_weighted(CAST(TRUE AS TINYINT), 1, 1)`, remain valid. Other supported value types and existing weight conversions are unchanged. BOOLEAN is absent from the value types listed in the [TOPN_WEIGHTED documentation](https://doris.apache.org/docs/dev/sql-manual/sql-functions/aggregate-functions/topn-weighted/). ### Release note Reject BOOLEAN value arguments to TOPN_WEIGHTED during query analysis instead of failing during backend initialization. Explicit casts to supported value types remain valid. ### Check List (For Author) - Test - [x] Unit Test: `CheckExpressionLegalityTest` passed all 9 tests through `run-fe-ut.sh`. New coverage includes 18 rejected BOOLEAN queries and 12 supported-input queries across both overloads, including DISTINCT, typed NULL, nullable slots, predicates, explicit numeric casts, and existing weight conversions. - [ ] Regression test: added 8 expected-error cases to the existing `topn` suite; not executed against a live cluster locally. - FE Checkstyle passed with zero violations; `git diff --check` passed. - Behavior changed: - [x] Yes. Unsupported BOOLEAN value arguments now fail during FE analysis with a function-specific error. - Does this need documentation? - [x] No. The documented value types already exclude BOOLEAN. ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label -- 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]
