nanjeshramesh opened a new pull request, #20402: URL: https://github.com/apache/druid/pull/20402
Fixes #17425. ### Description People using Druid's native engine write `CAST(x AS LONG)` because `LONG` is the name the native engine uses for its 64-bit integer type. The SQL parser only recognized `BIGINT`, so that CAST failed with a parse error even though `LONG` and `BIGINT` mean the same thing. #### Accept LONG as an alias for BIGINT `LONG` is added to the `SqlTypeName1` production in `Parser.jj` alongside `BIGINT`, in the same alternative, so both parse to `SqlTypeName.BIGINT` and behave identically (including the existing `UNSIGNED` suffix handling). No new `ColumnType` or code path is introduced; `CAST(x AS LONG)` is indistinguishable from `CAST(x AS BIGINT)` downstream. `LONG` is also added to `nonReservedKeywordsToAdd` in `config.fmpp`, following the same pattern already used for `OVERWRITE`, `EXTERN`, `IF`, `PROPERTIES`, `PROJECTION` and `SEALED`. This keeps `LONG` usable unquoted as an ordinary identifier (a column or alias named `long`), so the change is additive only. #### Release note `CAST(x AS LONG)` is now accepted as an alias for `CAST(x AS BIGINT)` in Druid SQL. <hr> ##### Key changed/added classes in this PR * `sql/src/main/codegen/config.fmpp` * `sql/src/main/codegen/templates/Parser.jj` <hr> This PR has: - [x] been self-reviewed. - [x] added documentation for new or modified features or behaviors. - [x] a release note entry in the PR description. - [x] added or updated tests to cover the new code path (`testCountStarWithFilterOnCastAsLong`, `testLongIsUsableAsAnIdentifier` in `CalciteQueryTest`). -- 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]
