zhan7236 opened a new pull request, #18789:
URL: https://github.com/apache/druid/pull/18789

   ### Description
   
   This PR adds support for using `LONG` as an alias for `BIGINT` in SQL CAST 
expressions. Users who are familiar with Druid's native engine often use `LONG` 
as a type name, but the SQL parser previously did not recognize it, resulting 
in an error.
   
   After this change, the following SQL will work correctly:
   ```sql
   SELECT CAST(column_name AS LONG) FROM table
   ```
   This is equivalent to:
   ```sql
   SELECT CAST(column_name AS BIGINT) FROM table
   ```
   
   ### Motivation
   
   People using the native engine may write `CAST(some AS LONG)` because they 
are accustomed to working with those types. However, the SQL parser didn't know 
that type and returned an error. This change handles `LONG` as an alias to 
`BIGINT` for better user experience.
   
   Fixes #17425
   
   ### Changes
   
   - **config.fmpp**: Added `LONG` to the keywords list.
   - **Parser.jj**: Modified `SqlTypeName1` rule to accept `LONG` as an alias 
for `BIGINT` (similar to how `INT` is an alias for `INTEGER`).
   - **CalciteQueryTest.java**: Added test case `testCastAsLongAliasBigint()` 
to verify the new functionality.
   
   ### Testing
   
   - Added unit test `testCastAsLongAliasBigint()` that verifies `CAST(dim1 AS 
LONG) = 2` produces the same query plan as `CAST(dim1 AS BIGINT) = 2`.
   
   ### Checklist
   
   - [x] I have read the contribution guidelines
   - [x] My code follows the existing coding style
   - [x] I have added tests that prove my fix is effective
   - [x] This PR is based on the latest master branch


-- 
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]

Reply via email to